0

addCLass メソッドを適用するときに JQuery が border-bottom css プロパティを適用しない理由を知りたいです。色は適用されますが、境界線は適用されません。何故ですか?JSFiddle: http://jsfiddle.net/egh7a/

ありがとう。

html

<section class="news">
    <article>one</article>
    <article>two</article>
    <article>three</article>
    <article>four</article>
</section>

jQuery

$(".news article:last").addClass("two");

CSS

.news {
   border-top: 1px solid #777;
}

.news article {
   padding-top: 10px;
   padding-bottom; 10px;
   border-bottom: 1px dashed #999;
}

.two {
   color: red;
   border-bottom: black solid 2px; 
}
4

2 に答える 2

5

article アイテムは、より具体的な css ルールからスタイルを取得します。

この場合.news article、より具体的です.two

代わりに.twoクラスを変更してみてください。.news .two

于 2013-07-01T08:26:57.770 に答える