Jump to content

Div ID cancels out Style


EchoFool

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

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.