<style> @import "css/a.css" ; </style>
代码示例如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>css样式</title> <!-- <style> div{ color: blue; } </style>--> <link rel="stylesheet" href="css/a.css"> </head> <body> <!--1、内联样式(不常用) 在标签内使用style属性来指定css代码--> <!--<div style="color: red">Hello word</div>--> <!-- 2、内部样式--> <!-- 在head标签内定义 style标签,style标签的标签题内容就是css代码--> <!--<div>Hello word 内部样式</div>--> <!-- 3、外部样式 在head标签中用link引用外部的css资源 --> <div>Hello word 外部部样式</div> </body> </html>
定义的a.css文件中的内容为:
div{ color: green; }
原文:https://www.cnblogs.com/lpss-75074038/p/12191674.html