欢迎光临
我们一直在努力

CSS Selectors, Pseudoclasses, and Pseudoelements

Selector Type Example Note
Universal selector * { color:#555; } /
Type selectors b { color:red; } div,p select all <div> elements and all <p> elements.
Class selectors .classname { color:blue; } /
ID selectors #idname { background:cyan; } /
Descendant selectors span em { color:green } Select all <em> elements who have a parent element of <span>.
Child selectors div > em { background:lime; } Select all <em> elements who have a direct parent element of <div>
Adjacent sibling selectors i + b { color:gray; } Select the <b> element who is directly after the <i> element, and meanwhile both the <i> and <b> elements should be within a same parent element.
Attribute selectors a[href=’info.htm’] { color:red; } /
Pseudoclasses a:hover { font-weight:bold; } /
Pseudoelements p::first-letter { font-size:300% } /
赞(0) 打赏(金额可任意指定)
未经允许不得转载:峰间的云 » CSS Selectors, Pseudoclasses, and Pseudoelements
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

上海宝山顾村棉被加工店 专业加工新旧棉被

查看详情了解一下

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏