0

以下は、組み込みページの HTML です。

<div class="notes quotes-notification member-savings f-left">
<h2>My Notifications</h2>
<ul>
<li><b>need to modify the HTML a little more than on the other pages you worked your account. </li>
<li>An <a href="#">answer has been posted</a> to a question you submitted.</li>
<li>A shop responded to a <a href="#">review you posted</a>.</li>
</ul>
</div>

quotes-notificationそして member-savings両方とも以下のように異なるcssを持っています:

.member-savings {
    width: 19%;
    margin-right: 1.6%; 
    border: 2px solid #0c86c9;
}
.quotes-notification{
    width: 32%; 
}

このページでは、通知ブロックで幅を 32% にする必要がありますが、このブロックは 19% を幅と見なし、32% をオーバーライドします。ここでは、クラスを削除できませんmember-savings19% を無視する方法はありますか?

4

1 に答える 1

0

!importantfor を指定するwidth:32%;ことは、これを実現する 1 つの方法です。しかし、これは推奨される方法ではありません。もう 1 つの方法は、 の CSS 宣言の特異性を高めようとすることですquotes-notification。つまり、次の代わりに:

.quotes-notification{
    width: 32%; 
}

次のようなものを試してください:

body div.quotes-notification {
    width: 32%; 
}
于 2012-07-02T06:39:36.010 に答える