开发者

how to apply css to a link within a particular div only?

Here is my situation. I have 3 divs on my website. There is a button in each of divs. Here is my codes :

<div id="gg1">
  <a class="btn">
</div>
<div id="gg2">
  <a class="btn">
</div>
<div id="gg3">
  <a class="btn">
<开发者_StackOverflow社区/div>

May I know how to apply css style to 1 button only without effect on other 2 buttons Css or Jquery? Note that I cannot change the class and id of the buttons.


Use a descendant selector:

#gg1 a.btn {
    /* styles here affect only a.btn elements within #gg1 */
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜