envexlabs Posted September 6, 2007 Share Posted September 6, 2007 Hey, I have a piece of PHP code that is rendering out even and odd classes. this is exactly what the code is outputting: <div class="one"id="233">Once</div> <div class="two"id="235">Two</div> <div class="one"id="234">One</div> The css code is as follows, and it's at the bottom of the css page, so i know nothing is being overwritten: .one{ background: red; font: 3em/1em helvetica, arial, sans-serif; } .two{ background: white; font: 1.4em/1em helvetica, arial, sans-serif; border-top: 1px solid #efefef; padding: 7px 0 7px 5px; } Only the div with class="two" is being effected by the css, the other div="one" is plain. I've gotten the other web designer to take a look at it, and we can't figure it out to save our lives Quote Link to comment https://forums.phpfreaks.com/topic/68248-classes-mind-boggling/ Share on other sites More sharing options...
micah1701 Posted September 6, 2007 Share Posted September 6, 2007 based on just the code you provided, it worked fine for me. perhaps there's something else in your page thats overriding the class definition? Quote Link to comment https://forums.phpfreaks.com/topic/68248-classes-mind-boggling/#findComment-343162 Share on other sites More sharing options...
moberemk Posted September 6, 2007 Share Posted September 6, 2007 Whenever a style doesn't work, always check what other styles are being applied to that same class or tag; also, is that the exact code, or paraphrased? Be sure to check the output to make sure that it matches that exactly. Quote Link to comment https://forums.phpfreaks.com/topic/68248-classes-mind-boggling/#findComment-343171 Share on other sites More sharing options...
bronzemonkey Posted September 6, 2007 Share Posted September 6, 2007 No way to help for sure if we don't know what the rest of your CSS and (X)HTML are doing. Sounds possibly like a problem with specificity, try adding this to your CSS: .one {font: 3em/1em helvetica, arial, sans-serif !important; background: red !important;} If it "fixes the problem" then you have a specificity issue...you will have to resolve it. Don't resort to using !important. If it doesn't make a difference then I don't know what could be wrong without seeing more code. Also, you need to put a space between class and id in your markup: <div class="one"id="233"> should be <div class="one" id="233"> Quote Link to comment https://forums.phpfreaks.com/topic/68248-classes-mind-boggling/#findComment-343337 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.