CSS ?? ??
CSS ?? ??
CSS ?? ??? ???? ? ?? ?? ??? ???? ? ?????.
??
?? ?? ??:
CSS ???? ?? ??? ??? ?? ????:
: ? ?? ? ?? ??
"? ?? ?" ?? ??? ???? ? ?? ?? ??? ???? ???? ? ?????.
?? ??? ????? "? ?? ?" ?? ??? ???? ?? p ??? ? ?? ??? ? ??? ?????.
<!DOCTYPE html> <html> <head> <style> p:first-line { color:#ff0000; font-variant:small-caps; } </style> </head> <body> <p>您可以使用:線偽元素添加特殊效果給第一行文本。</p> </body> </html>
????? ???? ??? ???
??:"? ?? ?" ?? ??? ?? ?? ???? ??? ? ????.
??: "? ?? ?" ?? ??? ?? ??? ??? ? ????.
- ?? ??
- ?? ??
- ?? ??
- ?? ??
- ?? ??
- text -??
- vertical-align
- text-transform
- line-height
- clear
: ? ?? ?? ??
"? ??" ?? ??? ??? ???? ???? ? ?????. ???? ? ??:
?
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> p:first-letter { color:#ff0000; font-size:xx-large; } </style> </head> <body> <p>You can use the :first-letter pseudo-element to add a special effect to the first character of a text!</p> </body> </html>
????? ???? ??? ???
??: "? ??" ?? ??? ?? ???? ??? ? ????. ??.
??: "? ??" ?? ??? ?? ??? ??? ? ????.
- ?? ??
- ?? ??
- ?? ??
- ?? ??
- ?? ??
- ??? ??
- text- ??
- vertical-align ("float"? "none"? ????)
- text-transform
- line-height
- float
- clear
?? ?? ? CSS ???
pseudo- ??? CSS ???? ??? ? ????. :
<p class="article">??? ??</p>
The ?? ?? ?? ???? ?? ??? ? ??? ????? ??? ????.
?? ?? ??
? ?? ?? ??? ???? ??? ? ????.
?? ???? ??? ? ??? ????? ???? ?? ??? xx-large? ???. ? ?? ?? ??? ???? ????? ?? ???? ?????.
??? ??? ???? ?? ?? ??? ???? ?????.
?
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> p:first-letter { color:#ff0000; font-size:xx-large; } p:first-line { color:#0000ff; font-variant:small-caps; } </style> </head> <body> <p>You can combine the :first-letter and :first-line pseudo-elements to add a special effect to the first letter and the first line of a text!</p> </body> </html>
????? ???? ??? ???
CSS - :before ?? ??
":before" ?? ??? ??? ??? ?? ? ???? ??? ? ????.
?? ???? ? <h1> ?? ?? ???? ?????.
Example
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> h1:before {content:url(https://img.php.cn/upload/course/000/000/006/5809800b44336872.jpg);} </style> </head> <body> <h1>This is a heading</h1> <p>The :before pseudo-element inserts content before an element.</p> <h1>This is a heading</h1> <p><b>注意:</b>僅當(dāng) !DOCTYPE 已經(jīng)聲明 IE8 支持這個內(nèi)容屬性</p> </body> </html>
????? ???? ??? ???
CSS - :after pseudo-element
":after" ?? ??? ??? ??? ?? ? ???? ??? ? ????.
?? ????? ? <h1> ?? ?? ???? ?????.
Example
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style> h1:after {content:url(https://img.php.cn/upload/course/000/000/006/5809800b44336872.jpg);} </style> </head> <body> <h1>This is a heading</h1> <p>The :after pseudo-element inserts content after an element.</p> <h1>This is a heading</h1> <p><b>注意:</b>僅當(dāng)!DOCTYPE 已經(jīng)聲明 IE8支持這個內(nèi)容屬性.</p> </body> </html>
????? ???? ??? ???
?? CSS ?? ???/??
Selector | ? | ?? ?? |
---|---|---|
:link | a:link | ???? ?? ?? ?? ?? |
:visited | a:visited | ??? ?? ?? ?? |
:active | a :?? | ?? ??? ????? |
:hover | a:hover | ?? ?? ???? ????? |
:focus | input:focus | ?? ? ???? ?? ??? ????? |
: first-letter | p:first-letter | ? ??? ? ?? ?? |
:first-line | p:first-line | ? ??? ? ?? ?? ? ? |
:first-child | p:first-child | ???? ?? ??? ? ?? ??? <]p> ??? ?????. |
:before | p: before | Insert ? ?? |
:after | p:after | ? element |
?? ??? ??:lang(??) | p:lang (it) | ??? ????? ?? |