Jump to content

Help with positioning divs


Darkmatter5

Recommended Posts

Here's the CSS

 

#wrap { width: 95%; position: relative; padding: 0 5px 0 5px; margin: 0 auto; background-color: #FFFFFF; }
#header { /*position: relative;*/ height: 70px; width: 100%; background-color: aqua; }
#status { height: 100px; width: 100%; background-color: blue; }
#navcontainer { line-height: 2.5em; height: 30px; width: 100%; background-color: fuchsia; }
#content { /*padding: 1em;*/ max-width: 100%; min-height: 200px; position: relative; background-color: green; }
#left_menu { width: 200px; min-height: 100%; float: left; background-color: red; }
#right_menu { width: 200px; min-height: 100%; float: right; background-color: aqua; }
.profile { width: 200px; margin: 0 auto; background-color: lime; }

 

Here's the HTML

 

<div id="wrap">
  <div id="header">header</div>
  <div id="status">status</div>
  <div id="navcontainer"><?php //$wm->user_rights($page); ?></div>
  <div id="content">
    <div id="left_menu">MENU</div>
    <?php $wm->list_profiles(); ?>
    <div id="right_menu">MENU</div>
  </div>
</div>

 

Here's the PHP for list_profiles();

 

function list_profiles() {
  $result=mysql_query("SELECT * FROM profiles ORDER BY name ASC") or die(mysql_error());
  //$row=mysql_fetch_array($result);
  $count=mysql_num_rows($result);
  switch ($count) {
    case 0:
      echo "<div class='profile'>ZERO</div>";
      break;
    case 1:
      echo "<div class='profile'>ONE</div>";
      break;
    case 2:
      echo "<div class='profile'>TWO</div>";
      break;
  }
}

 

I'm wanting to get the left_menu, profile and right_menu divs to all be aligned, but if I apply "style='display: inline;" to the profile div, it makes the profile div not centered and forces it against the left_menu div, but the three divs are inline.  If I render with the code as is, the right_menu div renders down a line.

 

Help please!

Link to comment
https://forums.phpfreaks.com/topic/166847-help-with-positioning-divs/
Share on other sites

Try changing this:

 

  <div id="content">
    <div id="left_menu">MENU</div>
    <?php $wm->list_profiles(); ?>
    <div id="right_menu">MENU</div>
  </div>

 

to this

 

  <div id="content">
    <div id="right_menu">MENU</div>
    <div id="left_menu">MENU</div>
    <?php $wm->list_profiles(); ?>
  </div>

 

(leave your CSS as is)

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.