これを理解するのは本当に難しいです。しかし、既存のインライン css に !important を追加するだけのサンプル スクリプトを教えてもらえますか?
6 に答える
3
以下のコードを使用して、インラインに !important を追加できます。
タグにinline
cssを追加したい場合、以下のコードを使用してそれを行うことができます。div
CSS の方法
<div style="color:red !important"
jQuery
$('div').attr('style', 'color:red !important;');
于 2013-09-14T04:50:23.333 に答える
1
$(element).attr('style', 'height:200px !important;')
于 2013-09-14T04:50:24.020 に答える
1
HTML
<div class="yourelementclass"></div>
JS コード
$('.yourelementclass').attr('style', 'width:500px !important;')
于 2013-09-14T04:51:18.037 に答える
1
ライブラリ固有でない方法は、 += 演算子を使用!important
して値に追加することです。
<div style="width:50px;" id="id1"></div>
document.getElementById("id1").style.width += " !important";
于 2013-09-14T05:01:53.307 に答える
0
$('img')[0].style.setProperty( 'width', '500px', 'important' );
于 2013-09-14T04:53:31.817 に答える