startl

1.直接引用,将style作为标签的属性

2.将style写为标签作为head的一部分

3.通过<link>引入css外部文件

4.通过import 导入css外部文件

for example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--引入css的第2种方式: div---通过选择器选择的标签,color---属性名,red--属性值-->
<!--<style>-->
<!--div{-->
<!--color:red;-->
<!---->
<!--}-->
<!--</style>-->
<!--引入css的第3种方式-->
<!--<link type="text/css" href="css_text.css" rel="stylesheet">-->
<!--引入css的第4种方式-->
<style>
@import \'css_text.css\';
</style>


</head>
<body>
<!--引入css的第一种方式-->
<p style="color:red;background-color:black">hello p</p>
<div>hello div1</div>
</body>
</html>
========================================================================================
文件名为"css_text.css"的css文件
div{
color:blue;
background-color: green;
}

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2022-01-06
  • 2021-09-07
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2021-11-15
  • 2022-12-23
  • 2021-12-08
相关资源
相似解决方案