When to use the ! statement

Asked

Viewed 29 times

0

I am creating a site in Wordpress, and the theme set the font color for all pages. I wanted to change the font color in a textarea of the blog comments. I created a child theme and in the style page I changed the color using the "color" property. I updated the site, but the change did not take effect. Searching the web I discovered the use of the ! Important statement. I implemented and it worked. It was correct what I did?

  • It is not ideal. The correct thing would be to cascade, as the name itself defines it. I recommend this article to know more: https://zenorocha.com/css-important/

  • I understand. It is that the property was inline in the HTML of the page. I thought that putting in the external style sheet (son) would be correct, in a future update of the parent theme. But thank you.

  • ! Important basically tells the browser to ignore the CSS hierarchy and use the style you are using ! Important. There is not much right and wrong when it comes to a Framework the size of WP, of course the best would be not Salo, but as not always the CSS is available will anyway, do not worry about it, unless you will put ! Import in all classes

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.