css3 中的偽類和偽元素

昔憶落落發表於2019-01-28

常見偽類---- :hover, :link, :active, :target, :not(), :focus

常見偽元素---- :first-letter, ::first-line, ::before, ::after, ::selection

one. ::before和 ::after

1. ::before和 ::after 的特有屬性content,在css渲染中向元素邏輯上的頭部或者尾部新增內容。這些新增不會出現在DOM中,不會改變文件的內容,所以不要用::before 或 ::after 展示有實際意義的內容,儘量使用它們修飾內容,例如圖示。

css3 中的偽類和偽元素
css3 中的偽類和偽元素

content屬性:

用content來指定插入內容,content必須有值,至少為空

預設情況下,偽類元素的display是預設inline,可通過display:block來改變其顯示。

html特殊字元的html,js,css寫法彙總:

http://www.cnblogs.com/starof/p/4718550.html

two. hover

滑鼠移入元素改變元素樣式。


相關文章