CSS
CSS 语法基础与实践
随着
- 浏览器缺省
(browser default)( 优先级最低) - 外部样式表
(Extenal Style Sheet) - 内部样式表
(Internal Style Sheet) - 内嵌样式表
(Inline Style)( 优先级最高)
我们可以用内嵌样式
<p style="font-size:20pt; color:red">这个Style定义<p>
</p>里面的文字是20pt字体,字体颜色是红色。</p>
内部样式表是写在
<html>
<head>
<style type="text/css">
h1.mylayout {
border-width: 1;
border: solid;
text-align: center;
color: red;
}
</style>
</head>
<body>
<h1 class="mylayout">这个标题使用了Style。</h1>
<h1>这个标题没有使用Style。</h1>
</body>
</html>
内部样式表
<style type="text/css">
......;
</style>
将样式
p { background-color:green; } @import url(import/one.css); @import
url(import/two.css);
<html>
<head>
<link href="linkd.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>这个标题使用了Style。</h1>
</body>
</html>
使用外部