CSS 样式分类

CSS样式可以分为三大类:内联样式、内部样式表和外部样式表

1.内联样式(样式写在html标签里,只对该标签的内容起作用)

<span style="color:red;font-size:48;">Hello World!</span>

2.内部样式(样式写在html的head标签之间,只对该html的内容起作用)

<html>
    <head> 
    <title></title>
    <style type="text/css">
    body{font-size:12px}    
    </style>
    </head>
    <body></body>
</html>

3.外部样式(样式引用写在head标签之间,对引用该css文件的网页起作用)

<html>
    <head> 
    <title></title>
    <link href="common.css” rel="stylesheet" type="text/css"> 
    </head>
    <body></body>
</html>

 css样式中#表示id选择器,.表示类选择器

<div class="font"></div>

<div id="top"></div>在html中id是不能重复的。

 

 

posted on 2014-12-03 15:58  lovezj9012  阅读(630)  评论(0编辑  收藏  举报

导航