Even though I've been in the job for half a year and I'm a front-end engineer, I really don't ... (There's a guilt I'm guilty of my damn feeling
From the form of CSS-style code insertion, the basic can be divided into the following 3 kinds: inline, embedded and external three kinds.
1. Inline type
Inline CSS stylesheet is to write CSS code directly in the existing HTML tags, such as the following code:
<p style= "Color:red" > here the text is red. </p>
The CSS code is written in the start tag of the element.
CSS style code to write in style= "" double quotes, if there are multiple CSS style code settings can be written together, separated by semicolons.
2. Embedded
The embedded CSS style is the ability to write CSS style code between <style type= "text/css" ></style> tags. The following code is implemented to set the text in three <span> tags to red:
<style type= "Text/css" >span {color:red;} </style>
Embedded CSS styles must be written between <style></style>, and in general the embedded CSS style is written between
3. External type
An external CSS style (also known as an inline) is to write the CSS code in a separate external file, with the CSS style file " .css
" as the extension, within
<link href= "Base.css" rel= "stylesheet" type= "Text/css"/>
Attention:
1. CSS style file names are named with meaningful English letters, such as MAIN.CSS.
2, rel= "stylesheet" type= "text/css" is fixed notation cannot be modified.
3, <link> label location is generally written in the
4. Priority in three ways
The nearest principle (the higher the precedence level from the Set element).
Priority: inline > Embedded > External
But embedded > external has a premise: the placement of the embedded CSS style must be behind the exterior. As is the case with the right code editor, <link href= "Style.css" ...> code in front of <style type= "Text/css" >...</style> Code (also written in the actual development)
But note that the precedence summarized above is premised on the premise that CSS styles in inline, inline, and external style sheets are in the same weighted value case
Three ways to introduce CSS