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

Link to comment
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.