标签:
CSS导入使用及引用的两种方法:
?
CssUse.html文件代码:
?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
????<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
????<link rel="stylesheet" type="text/css" href="direct.css">
????<title>CSS Use</title>
????<style type="text/css">
????????@import url("http://localhost/cssUse/waysToImportCss.css");
????????h2 { color: green; }
????</style>
</head>
<body>
????<h1>通过link连接的样式</h1>
????<p>通过link连接的样式</p>
????<h2>直接写的样式</h2>
????<a href="#">import导入的样式</a>
</body>
</html>
Direct.css文件代码:
????h1 { color: blue; }
p { color: yellow; }
waysToImportCss.css文件代码:
????a { padding: 0 5px;}
a:hover { color: lightblue; }
a:visited { color: yellow; }
标签:
原文地址:http://www.cnblogs.com/jlienzen/p/5046934.html