css

来源:互联网 发布:手机淘宝哪里看追评 编辑:程序博客网 时间:2024/05/21 20:28

css是Cascading Style Sheets的简写,是对网页的显示效果实现与Word一样的排版控制。
设置CSS的几种方式
内联样式表
<meta http-equiv="Content-Style-Type" content="text/css">
嵌入样式表
<html>
 <head>
  <style  media="screen,projection">
   <!--
    P{Font-size:20pt;color:blue;font-family:宋体;list-style-type:
    circle;text-decoration:underline}
   -->
  </style>
  </head>
  <body>
  <p> haieiaiogo</p>
  <p>aohgoajhgoao</p>
  </body>
</html>
外部样式表
编写test.css文件
P{
 font-size:20pt;color:bule;font-family:隶书;
 list-style-type:circle;text-decoration:underline
}
编写使用样式表文件的网页文件,都在同一目录下
<html>
 <head>
  <link rel="StyleSheet" href="test.css" type="text/css" media="screen">
 </head>
 <body>
  <p>this is a css test.</p>
 </body>
</html>
输入样式表
可以使用@import声明将一个外部样式表文件(css)文件输入到另一个Css文件或网页文件的<style>标签对中。
例子:
<style type="text/css" media="screen,projection">
<!--
 @import url(http://www.heut.edu.cn/style.css);
 @import url(/stylesheets/style.css);
 p{background:yellow;color:black}
-->
</style>
.............................................................................
样式规则的选择器
HTML selector
Class selector
ID selector
关联选择器
组合选择器
伪元素选择器

原创粉丝点击