Home » CSS » 4 ways of introducing CSS

4 ways of introducing CSS

4 ways of introducing
CSS

  • inline style


<p style= "color:red" > paragraph p>


  • embedded style


<html>
<head>
"<style type=", "text/css", >
#box1{
width: 100px; height: 200px;
}

< - P{color: red; }-->
< -- --> is not used to display the contents of a stylesheet when browsers do not support stylesheets
style>
head>
<body>
<div id=, "box1", ">hello worlddiv>"
<p>hello worldp>
body>
html>


  • outer chain style


<head>
<link rel=, "stylesheet", "type=", "text/css", "href=" >
head>


  • import style sheet


<style>
@import url (, style.css, ) ;
style>

Description: import, in fact, is similar to inline style, adding styles to a web page.

1. import type will take up HTML file space

2., many browsers will have problems parsing,

3. @import URL ("" "). Multiple styles files can be imported into a style file to

For example, if you have style.css and hello.css files, write
in the basic.css file
@import URL ("style.css");

@import URL ("hello.css");

The basic.css file introduces the two files in front,


Priority order rules

  • nearest principle,


Latest