" head tag of the HTML document and define it with the "
"."/> " head tag of the HTML document and define it with the " ".">Home > Article > Web Front-end > How to use inline to introduce css style sheet
Introduction method: Write the CSS code in the "93f0f5c25f18dab9d176bd4f6de5d30e" header tag of the HTML document, and define it with the "c9ccee2e6ea535a969eb3f532ad9fe89" tag; the syntax format is "93f0f5c25f18dab9d176bd4f6de5d30e8ee02bccf80c76cee1c966dc94ac9466selector{property:property value;}531ac245ce3e4fe3d50054a55f2659279c3bca370b5104690d9ef395f2c5f8d1".
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
CSS is used to modify web page styles. However, if you want the styles modified by CSS to work, you must introduce a CSS style sheet into the html file. There are three common ways to introduce style sheets, namely inline, embedded, and external links. The following article will give you a detailed introduction to embedded.
CSS Embedded
Inline is to write the CSS code in the 93f0f5c25f18dab9d176bd4f6de5d30e header tag of the HTML document, and use c9ccee2e6ea535a969eb3f532ad9fe89 Tag definition, its basic syntax format is as follows:
<head> <style type="text/css"> 选择器{属性1:属性值1;属性2:属性值2;属性3:属性值3;} </style> </head>
In this syntax, the c9ccee2e6ea535a969eb3f532ad9fe89 tag is generally located after the b2386ffb911b14667cb8f0f91ea547a7 tag in the 93f0f5c25f18dab9d176bd4f6de5d30e tag, or it can be placed at the end of the HTML document Anywhere. However, since the browser parses the code from top to bottom, placing the CSS code in the header facilitates downloading and parsing in advance to avoid the embarrassment caused by no style modification after the web page content is downloaded. (Learning video sharing: css video tutorial)
At the same time, the attribute value of type must be set to "text/css", so that the browser knows that the c9ccee2e6ea535a969eb3f532ad9fe89 tag contains CSS code , because the c9ccee2e6ea535a969eb3f532ad9fe89 tag can also contain other code, such as JavaScript code.
<head> <title>内嵌式引入CSS样式表</title> <style type="text/css"> h2{text-align:center;} p{font-size:16px;color:red;text-decoration:underline;} </style> </head> <body> <h2>内嵌式CSS样式</h2> <p>使用style标记可定义内嵌式CSS样式表,style标记一般位于head头部标记中,title标记之后。</p> </body>
Inline CSS styles are only valid for the HTML page in which they are located. Therefore, when designing only one page, using inline is a good choice. But if you are on a website, it is not recommended to use this method because it cannot take full advantage of CSS code reuse.
For more programming related knowledge, please visit: Programming Video! !
The above is the detailed content of How to use inline to introduce css style sheet. For more information, please follow other related articles on the PHP Chinese website!