How to cover! important?
P粉200138510
P粉200138510 2023-08-23 18:46:30
0
2
358
<p>I created a custom stylesheet that overrides the original CSS of my WordPress template. However, on my calendar page, the original CSS sets the height of each table cell using the <code>!important</code> declaration: </p> <pre class="brush:php;toolbar:false;">td {height: 100px !important}</pre> <p>Is there any way to override this? </p>
P粉200138510
P粉200138510

reply all(2)
P粉642919823

In addition to overriding the style set by the style attribute, !important is only used if the selector in the stylesheet matches the specificity .

However, even if your specificities conflict, it is better to create a more specific selector for the exception. For your case, it's better to include a class in the HTML, which you can use to create more specific selectors that don't require !important rules.

td.a-semantic-class-name { height: 100px; }

I personally never use !important in a stylesheet. Remember, the C in CSS stands for cascade. Using !important will break this.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!