Cascading Style Sheet——控制頁面的樣式;css
1996:CSS1--> 1998:CSS2--> 2001:CSS3--> 2007:CSS2.1
注:CSS3並非一個獨立的版本,而是一個一個的模塊兒;html
<head> <link rel="stylesheet" href="base.css"> </head>
<head> <style> body{background-color:red;} </style> </head>
<p style="color:red;margin:20px;">This is a paragraph</p>
CSS主要由選擇器
、屬性表達式
和註釋
構成;
web
selector { property1:value; property2:value; }
CSS屬性聲明=屬性名:屬性值;
CSS註釋:/*
+屬性表達式+*/
;瀏覽器
.pic { -webkit-transform:rotate(-3deg); -moz-transform:rotate(-3deg); -ms-transform:rotate(-3deg); -o-transform:rotate(-3deg); transform:rotate(-3deg); }
基本元素
+組合符號
+數量符號
spa
margin:[<lengh>|<percentage>|auto]{1,4}
auto
,solid
,bold
...<length>
/<percentage>
/<color>
...<'pading-width'>
,<color-stop>
.../
,,
inherit
,initial
<'font-size'> <'font-family'>
font:12px arial;
2em
/arial 14px
<length>&&<color>
gren 2px;
/1em blue
blue
/1em
underline||overline||line-through||blink
underline
/ overline underline
<color>|transparent
orange
/transparent
bold[thin||<length>]
bold thin
/bold 2em
/bold thin 16px?
<length>
1px
/10em
1px 2px
<color-stop>[,<color-stop>]+
#fff,red
/blue,green 50%,gray
red
inset?&&<color>
inset blue
/red
<length>{2,4}
1px 2px
/1px 2px 3px
<time>[,<time>]*
1s
/1s,4ms
<time>#
2s,4s
1ms 2ms
padding-top:<length>|<percentage>
padding-top:1px;
padding-top:1em 5%;
border-width:[<length>|thick|medium|thin]{1,4}
border-width:2px;
border-width:2px small;
box-shadow:[inset?&&[<length>{2,4}&&<color>?]]#|none
box-shadow:3px 3px rgb(50%,50%,50%),red 0 0 4px inset;
box-shadow:inset 2px 4px,2px blue;
使用規則:@標識符 XXX;
/@標識符 XXX{}
firefox
@import "subs.css"; @charset "utf-8"; @media print{ body{font-size:10pt} } @keyframes fadein{ 0%{top:0;} 50%{top:30px;} 100%{top:0;} }
其餘@標識符:@media
,@keyframes
,@font-face
,@import
,@charset
,@namespace
,@page
,@supports
,@document
3d