原文地址:http://ankyhe.iteye.com/blog/350565
这是CSS最基本的三种定义方法。
Inline Style 如下:
<h1 style="color: red">
Intrenal Style,就是在<head>的<title>后面跟着一个<style>,然后把css放在里面。
<title>Selector Basics</title>
<style type="text/css">
p {
color: #5f9794;
font-family: "Century Gothic", "Gill Sans", Arial, sans-serif;
font-size: 1em;
margin-left: 50px;
}
</style>
External Style,就是把所有的css定义在另一个文件里,然后通过链接的方法使用它。
<title>Selector Basics</title>
<link rel="stylesheet" type="text/css" href="global.css">
</head>
一般建议使用最后一种,因为这样不仅集中管理,而且可以增加网页的下载速度。

本文介绍了CSS的三种定义方法:内联样式(inline style)、内部样式表(intrenal style)及外部样式表(external style)。内联样式直接在HTML元素中定义;内部样式表在<head>部分使用<style>标签定义;而外部样式表则将样式保存在单独的.css文件中并通过<link>标签引入。推荐使用外部样式表,因为它便于管理和提高网页加载速度。
1158

被折叠的 条评论
为什么被折叠?



