How to write css external style sheet

anonymity
Release: 2019-05-28 09:43:28
Original
30021 people have browsed it

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.

How to write css external style sheet

Example:

style.css

span{
   color:red;
   font-size:20px;
}
Copy after login

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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template