Jump to content

Recommended Posts

Hey

 

I have a DIV with and ID and a style but it doesn't seem to execute the style if i have an ID with it. I use the ID to set the width and border and div position then the style to alternae the background color in a while loop but it doesn't work =/

 

 

#forumbody{
margin-left: auto;
margin-right: auto;
width: 90%;
border:  1px solid #000000;
}

 

<?php
$var = 0;
While($var != 5){

    if (!isset($i)) {
      $bg = '#000000';
      $i = 1;
    }
    else {
      $bg = '#ffffff';
      unset($i);
    }
    
?>
<div style="background-color:<?php echo $bg;?>;" id="forumbody"> Test</div>
<?php
$var = $var + 1;
} 
?>

 

Any one see why its not working ?

Link to comment
https://forums.phpfreaks.com/topic/202786-div-id-cancels-out-style/
Share on other sites

The style being set hardcoded via the styletag should override anything.

 

Try on a different browser, see if it is a browser issue.

 

Post the the View-Source of the page, to make sure that the alternating script works like it is suppose to.

  • 2 weeks later...
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.