External css style (also called external style) is to write the css code in a separate external file. This css style file has the extension name ".css" and is in
(not in < ;style> tag) use the tag to link the css style file to the HTML file, as shown in the following code:Note:
1. The css style file name is named with meaningful English letters, such as main.css.
2. rel="stylesheet" type="text/css" is a fixed writing method that cannot be modified.
3. The tag position is generally written within the
tag.Example:
style.css
span{ color:red; font-size:20px; }
index.html
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>嵌入式css样式</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <p>php中文网,<span>超酷的互联网</span>、IT技术免费学习平台,创新的网络一站式学习、实践体验;<span>服务及时贴心</span>,内容专业、<span>有趣易学</span>。专注服务互联网工程师快速成为技术高手!</p> </body> </html>
The above is the detailed content of How to write css external style sheet. For more information, please follow other related articles on the PHP Chinese website!