• I have some custom HTML with some additional css, e.g.

    <p class="cards-h">Vul: NS</p>

    with the css:

    .cards-h,
     {
      font-size: 16px !important;
      margin: 0px;
      padding: 0px;
      width: fit-content;
    }

    I have run the html (with css) locally and it all works perfectly. However, on my WordPress site only some of the css style components apply (e.g. colour of some letters) but the paragraph spacing seems to be being overridden by the theme.

    Theme: Minimal Blog By WPinterface

    Hopefully asking in the right place!

    Thank you,

    Mike

    • This topic was modified 2 years, 7 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • @shinjukumike If your theme has a support forum, you might have better luck there, but I’d recommend you read about CSS specificity and how it works. You should look at the specificity of the CSS rule that is overriding your styles and make sure your styles are more specific (ie they target your elements as specifically as possible so that it has a higher specificity, and will be used on your page).

    Moderator bcworkz

    (@bcworkz)

    CSS optimization processes can inadvertently alter the order CSS is evaluated, which will alter the application of rules with equal specificity. To test if this is happening, temporarily disable any CSS optimization on the site, along with disabling or flushing any caching (both server and client side). If optimization is the cause, either develop a rule that truly has greater specificity, or persistently disable CSS optimization. Any caching can remain active, it was only disabled for the test since CSS styles are often aggressively cached, confusing any test results.

    Thread Starter shinjukumike

    (@shinjukumike)

    Great, thank @bengreeley and @bcworkz, I’ll work through the CSS optimisation issue and have a try on the forum.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘custom css formatting being overridden by theme’ is closed to new replies.