引入css的四种方式

it2022-05-05  151

1.内联式引用:直接用在标签上,但维护成本高

style='font-size:16px;color:#000000'

2.外部连接式引用:css代码与html代码分离,便于代码重复使用

<link href="css/style.css" type="text/css" rel="stylesheet" />

style.css文件内容如右:

.font{color:blue;font-size:12px;}

3.内部式引用:页面较为清晰,但不能被别的页面使用

<style type='text/css'> .font{color:blue;font-size:12px;} </style>

4.外部导入式:可以在一个HTML文件中导入多个样式表。类似于外部链接式引用    在HTML文件中head标签中加入

<style type='text/css'> @import url('./style/style.css'); </style>

 

转载于:https://www.cnblogs.com/smart-hwt/p/8143606.html

相关资源:各显卡算力对照表!

最新回复(0)