CSS ?? ???
1. ?? ???? ??????
?? ???? html? ?? ??? ???? ???? ?? ????. ??? ??? HTML ??? ???? ?????.
?? ???? ??? ? ID ???? ??? ??? ??? ???? HTML ??? ???? ??? ? ????.
??: IE ????? ???? ?? IE6 ?? ????? ?? ??? ???? ????. IE7? !DOCTYPE? ??? ???? ?? ??? ??? ?????.
2. ?? ??? ??
?? ?? ?? ??? ?? ?? ??? ?? ?????. ???:
[??]
{
??: ???;
}
??? ?? ???
??? ???? ?? ???? ?? ?? ?? ?? ???? ?????.
h1[class] {color: silver;}? ??? ?? ???? ???? ?? ?? h1 ??? ?????. ??? <h1 class="hoopla">Hello</h1>, <h1 class="severe">Serenity</h1>, <h1 class="fancy">Fooling</h1>? h1? ; ? ??? ??? ????.
?? ? "??"? ???? ID?? ??? img? alt? ?? ??? ?? ???? ??? ? ???? img[alt]{css ??? ????;}? ?? ??? ?????. alt ??? ?? img ??? ?? ?????. [href][??] {font-weight:bold;}? ?????? ??? ????? ??? <a title="php Home">< /a>
??? ?? ? ???
id? class? ????? ??? ?? ? ??????. ?, h1#logo? h1[id="logo"]? ????. ?? ????? ID? ???? ???? ?? ?? ??? ??? ? ????! ?? ??, a[W3C Home"] {font-size: 200%;}?<a href="http://php.cn?? ?????. /" title="php ?"></a>.
?? ?? ? ???
???? ? ? ??? ?? ?? ????? ???? ?(??? ??? ??? ?? ??? ???? ??) ??. ?? ???????.
<p class="?? ??">????? ??? ?? ?? ??? ???? ??? ???? ???.</ p> ;p[class~="warning"] {font-weight:bold;}
?
p[class~="urgent"] {font-weight:bold;}
? ?? ??? ? p? ??? ? ??? ?? ? ????.
?? ?? ???????? ???? ???? ??? "Figure"?? ???? ??? ??(?: title = "Figure 5: xxx ??) ? ???? ?? ?????. "?? img[title~="Figure"]? ??? ? ????.
[title]: ?? ???
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php.cn</title> <style> h1[title]{ color:red; } </style> </head> <body> <h1 title = "屬性選擇器">標(biāo)題<h1> <p>這是內(nèi)容</p> <h1>標(biāo)題<h1> <p>這是內(nèi)容</p> </body> </html>
[title='hello']? ??? ?????. ??? title?? ?? hello? ??? ?????
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php.cn</title> <style> h1[title = "hello"]{ color:red; } </style> </head> <body> <h1 title = "屬性選擇器">標(biāo)題<h1> <p>這是內(nèi)容</p> <h1 title = "hello">標(biāo)題<h1> <p>這是內(nèi)容</p> </body> </html>
[title*='hello']: ??? title?? hello? ??? ??? ?????