In actual development, we divide the CSS introduction styles into 3 types according to the different positions of the CSS code. They are internal style , inline style and external style . Let's introduce the following styles one by one.
1. Internal style: that is, CSS code is written in the head part of HTML and used <style></style>
to include it.
2. Inline style: Use style directly inside the label, such as:
<标签名 style="样式设置语句 ">
3. External style: Write the CSS code in a special CSS file to completely realize the separation of structural styles.
How to use:
1. Create a file with the suffix .CSS, and write all CSS codes in this file.
2. Introduce the CSS file into the HTML file
Introduction method:
<link rel="stylesheet" href="CSS文件的路径">
* 1.引入常写在head中
* 1.引入标签中的rel属性为样式表,告诉浏览器使用那一个样式,通常默认值为stylesheet