All those who have studied web design know that CSS is flexible, and the style of web pages is completely separated from the code. With simple CSS code knowledge, you can immediately make a website that is not very beautiful and easily change its appearance. The previous article summarized the basics and advantages and disadvantages of CSS styles. This article introduces the usage of CSS styles.
I. CSS is used in Webpage Design in three ways. which method is used?
When multiple webpages use CSS to use external CSS files, this not only greatly reduces the Page code, but also facilitates modification, and improves reusability, in this way, a CSS file can control multiple HTML pages. CSS is used only in a single webpage and the document header is used. CSS styles are used only in one or two places on a webpage, it is convenient to use the intra-row style. You can modify the style when applying it.
II. The following describes three methods of CSS.
1. Intra-row style
<HTML>
2. Embedded Style
<HTML>
3. Link Style
The link style is to introduce a CSS file. CSS files can be stored on servers or local hard disks. The style content in the CSS file:
body {background-color: #FF0000;}
Insert the link statement in the HTML document:
<link rel="stylesheet" type="text/css" href="style.css" />
This line of link statements should be placed between
<HTML>
The preceding three methods show that the HTML page must be displayed according to the specified CSS style.
Conclusion: the combination of the above three methods in the web design process will not only cause confusion, but also be extremely flexible and efficient. If there are three methods in a webpage, the first check is the intra-row style, which is executed for its style; then the check is embedded style, that is, the header is inserted with CSS style; the last check is the connection style. That is, the priorities of the three methods are from high to low: Intra-row style, embedded style, and imported style.
PS: there is also a style introduced using @ import: it is similar to link usage, but it must be placed in <style>... </style>.
<STYLE TYPE="text/css"><!--@import url(http://yourweb/ example.css);--></STYLE>