Difference: The CSS external link method is to write the css code separately in a file with the extension ".css", and then use the link tag to link to the html. Inline CSS is to directly use the style attribute to write the css code in the HTML tag. Inline types are given higher weight than inline types.
The operating environment of this tutorial: windows7 system, css3&&html5 version, Dell G3 computer.
(Learning video sharing: css video tutorial)
CSS external link style--external link style sheet
Outside A chain style sheet is to write a separate file with a css extension, and then use the tag in
to link the css style to html. For example:<link href="css样式的名字(一般自己取).css" rel="stylesheet" type="text/css">
CSS inline--inline style sheet
Inline CSS can also be called inline CSS or row-level CSS, which is directly in the Introduced inside the tag.
For example:
<body> <p>莱昂纳多演的<span style="color:red">了不起的盖茨比</span>非常好看。</p> </body>
The obvious advantage is that it is very convenient and efficient; but it also has the disadvantage of not being able to reuse styles. If the number of lines of code reaches a certain length, it is not recommended. . Inline CSS is often used as a test to find bugs in the code.
The difference between CSS external link type and inline type
There is actually no essential difference between CSS external link type and inline type. Connections are easy to manage, and writing the same attributes together avoids code redundancy.
The weight priority is from high to low: inline > external.
For more programming-related knowledge, please visit: Introduction to Programming! !
The above is the detailed content of What is the difference between CSS external links and inline styles?. For more information, please follow other related articles on the PHP Chinese website!