开发者

What does this ID in CSS-Code?

Help me, please, to understand, what does the first line mean in CSS-Code:

#cont开发者_高级运维ent-right h1 {
  font-size: 100%;
 .....
  c...
}

That's ID, right? Why is h1 after #ID, shouldn't it be like h1#ID?


This is a descendant selector.

It selects all h1s inside of #content


#content-right h1 means a H1 element inside an element with id "content-right".

h1#content-right means a H1 element with the id "content-right".


basically it says all the h1 inside of a container with the id content-right have font-size 100% and whatever else is in there.


above css works on h1 inside div which have id=content-right

<h1>outside div</h1>
<div id ="content-right">
<h1>Inside div</h1>
</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜