そもそもなぜそれらを削除しないのですか?
それができない場合でも、CSS 宣言をルールでオーバーライドできます。
- 同じセレクタ優先度を持ち、MQ ブロックの後に来る
- MQ ブロックのルールよりも高いセレクタ優先度を持つ
!important
値とセミコロンの間にある
/* one id, one class AND one element => higher priority */
#id element.class { property: value2; }
/* !important will nuke priorities. Same side effects as a nuke,
don't do that at home except if you've tried other methods */
#id .class { property: value2 !important; }
@media(blah) {
/* Overridden. Thrice. */
#id .class { property: value1; }
}
/* same selector, same everything except it comes after the one in @media?
Then the latter is applied.
Being in a @media doesn't give any more priority (but it won't be applied
everywhere, depending on "blah", that's the point of MQ) */
#id .class { property: value2; }
前の例では、ブロックの外側の宣言のいずれかが@media
内側の宣言をオーバーライドします。たとえば、value1 ではなく value2 が適用される理由が 3 つあります。