css 常用的几种选取器
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">1、分组<span style="color: black;">选取</span>器</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">h1</span><span style="color: black;">,</span><span style="color: black;">h2</span><span style="color: black;">,</span><span style="color: black;">p</span> <span style="color: black;">{</span> <span style="color: black;">color</span><span style="color: black;">:</span><span style="color: black;">green</span><span style="color: black;">;</span> <span style="color: black;">}</span></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2、嵌套<span style="color: black;">选取</span>器</p>
<div style="color: black; text-align: left; margin-bottom: 10px;">.marked p{ }: 为所有 class="marked" 元素内的 p 元素指定一个样式。
p.marked{ }: 为所有 class="marked" 的 p 元素指定一个样式。</div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">3、后代<span style="color: black;">选取</span>器</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">后代<span style="color: black;">选取</span>器用于<span style="color: black;">选择</span>某元素的后代元素。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">以下实例<span style="color: black;">选择</span>所有 <p> 元素<span style="color: black;">插进</span>到 <div> 元素中: </p>
<div style="color: black; text-align: left; margin-bottom: 10px;">div p { bac<span style="color: black;">公斤</span>round-color:yellow; }</div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">4、子元素<span style="color: black;">选取</span>器</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">只能<span style="color: black;">选取</span><span style="color: black;">做为</span>某元素直接子元素的元素。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">以下实例<span style="color: black;">选取</span>了<div>元素中所有直接子元素 <p> :</p>
<div style="color: black; text-align: left; margin-bottom: 10px;">div>p { bac<span style="color: black;">公斤</span>round-color:yellow; }</div>
楼主继续加油啊!外链论坛加油! 顶楼主,说得太好了!
页:
[1]