1.外部样式表:
<head>
<link rel="stylesheet" type="text/css" href="a.css" />
</head>
2.内部样式表:
<head>
<style type="text/css">
.......
</style>
</head>
3.内联表
<p style="color:red;margin:0"></p>
css语法由3部分构成:select {property: value}
如果值为多个单词,则要给值加引号:p {font-family: "sans serif";}
多重声明:p {text-align: center; color:red;}
选择器分组:h1, h2, h3, h4, h5, h6 {color: green;}
继承:body {font-family: Verdana, sans-serif;}所有子元素都从body继承属性
a.css第一行:@charset "utf-8";
派生选择器:li strong {...}用于选择元素<li><strong>...</strong></li>
id选择器:#id1 {...}
类选择器:.class1 {...}
背景色:background-color:gray;
背景图像:background-image:url(/ab/cd/e.gif);
背景重复:background-repeat:repeat-x|repeat-y|no-repeat;
背景定位:background-position:center|top|bottom|right|left|50% 50%|100px 200px;
背景关联:background-attachment:scroll|fixed|inherit;
内边距:padding, padding-top, padding-right, padding-bottom, padding-left
边框:border, border-top, border-right, border-bottom, border-left, ...
外边距:margin, margin-top, margin-right, margin-bottom, margin-left
position: static, relative, absolute, fixed
float: left, right
a:link {...}
a:visited {...}
a:hover {...}
a:active {...}
LVHA顺序定义
如果您觉得本文的内容对您的学习有所帮助:
关键字:
jquery