How to override css containing '!important' using jquery?

前端 未结 15 709
清歌不尽
清歌不尽 2020-12-29 21:05

I want to apply height for specific div using jquery but not able to override the \'!important\' keyword using jquery.

Here is

15条回答
  •  渐次进展
    2020-12-29 21:15

    I dont understand why you have !important in your CSS if you hope to override it later. Remove the !important in your CSS height. CSS always prioritizes your HTML tag styles over CSS.

     .myclass{
       height:50px;
      }
    
      $('#divL3.myclass').css('height', '0px'); 
    

    This is better for design.

提交回复
热议问题