Jump to content

Recommended Posts

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 :P

Link to comment
https://forums.phpfreaks.com/topic/68248-classes-mind-boggling/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/68248-classes-mind-boggling/#findComment-343337
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.