ankyhe 发表于 2013-1-29 07:36:20

CSS Inline style, Internal style 和 External Style

这是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>
 
一般建议使用最后一种,因为这样不仅集中管理,而且可以增加网页的下载速度。
 
 
页: [1]
查看完整版本: CSS Inline style, Internal style 和 External Style