对于此代码
<div id="dogs" class="content">hello</div>
<div id="frogs" class="content">hello</div>
<div id="hogs" class="content">hello</div>
<div id="logs" class="content">hello</div>
如何从具有id狗的元素中选择类content
?
答案 0 :(得分:2)
你可以试试这个:
.content#dogs {
font: bold 28px sans-serif;
color: #800000;
}
<div id="dogs" class="content">hello</div>
<div id="frogs" class="content">hello</div>
<div id="hogs" class="content">hello</div>
<div id="logs" class="content">hello</div>