Support » Fixing WordPress » Custom CSS classes not working?

  • Resolved hoov


    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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.

    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.



    Forum Moderator

    A link to your site might help.

    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.

    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.



    Forum Moderator

    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 />

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



    Forum Moderator

    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

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

    Easy to replicate, visit here.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom CSS classes not working?’ is closed to new replies.