[resolved] Custom CSS classes not working? (10 posts)

  1. hoov
    Posted 6 years ago #

    Is there any reason why my custom CSS tags wouldn't be working? I'm modifying style.css for the correct theme.

    If I use one of the built in classes (.errorMessage for example) I can use it fine in the HTML.

    But if I create my own it doesn't work. I created a class called bold in the stylesheet as follows:
    .bold {font-weight: bold;}

    And the HTML looks like so:
    <span class="bold">test</span>

    That doesn't work and I can't understand why. I tried div class, and I also tried making the class into an ID; that didn't work either.

  2. Mark / t31os

    Posted 6 years ago #

    Does it suddenly work if you change the CSS to..

    .bold {font-weight: bold!important;}

    If the answer to the above is yes, then the reasoning is due to the inheritance of other styling in the styelsheet already..

    Firebug in firefox is a good way to see CSS inheritance for elements.

  3. hoov
    Posted 6 years ago #

    Unfortunately no that didn't work. I did download Firebug and I see what you mean about the CSS inheritance. That will definitely come in handy.

    Still trying to figure out why this isn't working though. Inline styles work fine of course.

  4. esmi
    Forum Moderator
    Posted 6 years ago #

    A link to your site might help.

  5. hoov
    Posted 6 years ago #


    Password is test. Trying to apply the styles to the word test on that page.

    Firebug shows the div class wrapping the word. And I see in body where font-weight is set but even if I turn that tag off my style doesn't apply. I'm trying it with the !important tag t31os_ mentioned above.

  6. hoov
    Posted 6 years ago #

    I gave up and installed the Persistent Styles plug-in which is working. So all is well now. I would still be interested in knowing why my CSS wasn't working though.

  7. Michael
    Part-Time Forum Moderator
    Posted 6 years ago #

    your css.php causes a 'parsing error' and that stops the style '.bold' from being applied.
    error code:

    <br />
    <b>Warning</b>:  parse_url(http://) [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL in <b>/home/content/i/d/e/ident20/html/blog/wp-content/themes/blend/css.php</b> on line <b>54</b><br />
  8. hoov
    Posted 6 years ago #

    Hmm, thank you. Where did you see that message?

  9. Michael
    Part-Time Forum Moderator
    Posted 6 years ago #

    in firefox, with the developer add-on (not firebug - although you might be able to use that as well). if you click 'css' -> 'edit css' ; that opens a few lines at the bottom of the screen. then click on 'css.php' if it is not already open.

    or you click 'css' -> 'view css' which opens a new tab with the css files

  10. Mark / t31os

    Posted 6 years ago #

    Spot on alchymyth, can confirm same error here (also use web developer addon) ..

    Easy to replicate, visit here.

Topic Closed

This topic has been closed to new replies.

About this Topic