第四章:CSS样式表

来源:互联网 发布:java项目根目录 编辑:程序博客网 时间:2024/05/07 10:07

                                         第四章:CSS样式表
单词: style class padding  text-decoration  background-repeat import  link

1.font里面设置字体大小范围是1-7,而如果用style,在里面设置的话,可以变更大. 

 

2.style的格式:
<head>
<style type="text/css">
  selector选择器
  {
     property属性: value属性值;
     property属性: value属性值;
  }
</style>
</head>

 

3.selector的分类:
  1)标签样式 选择器 (如:  table{background:url("chess.png")}  不用调用)
  2)类样式 选择器   (如:  .dream { font-size:14px;}   调用时class="dream")
  3)id样式 选择器   (如:  #note { font-size:14px; width:120px;} 调用时id="note")

 

4.样式表的三种应用方式:
  1)内嵌样式  (写在<head>里面)
  2)行内样式    (直接写在行内标签中)
  3)外部样式    (另存一个css样式文件,在head里用link或import引用)

 

5.外部样式表的引用方式
 <head>
  <link rel="stylesheet" href="newstyle.css" type="text/css">
 </head>

或者:
 <head>
  <style type="text/css">
 @import 样式文件.css
  </style>
 </head>

原创粉丝点击