views:

36

answers:

2

Hi,

I need the #infoBar div and the #actualCover div to sit to the right of (next to) the #covers div but for some reason, the covers div is acting like its not even there and floats on top of the other divs

please help

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
    <title>Untitled Page</title>
    <style type="text/css">
        *
        {
            margin: 0;
            padding: 0;
        }
        #chooserContainer
        {
            border: solid 1px orange;
        }
        #coverArea
        {
            border: solid 1px red;
            width: 760px;
        }
        #covers
        {
            width: 150px;
            float: left;
            height: 600px;
            overflow-y: auto;
            overflow-x: hidden;
            border: solid 2px #BFDEFF;
            padding: 10px;
            background-color: #F0F7FF;
            margin-right: 30px;
        }
        #infoBar
        {
            height: 30px;
            border: solid 1px green;
            width: 600px;
        }
        #actualCover
        {
            width: 794px;
            height: 1123px;
            background-position: top left;
        }
    </style>
</head>
<body>
    <div id="chooserContainer">
        <div id="covers">
        </div>
        <div id="infoBar">
        </div>
        <div id="coverArea">
            <div id="actualCover">
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>
</body>
</html>
A: 

In this case, it sounds like you want #infoBar and #coverArea to float to the right of #covers instead of #covers floating to the left of the other two.

Try taking the float off of #covers and adding float: right; to #infoBar and #coverArea

Justin Niessner
that didn't seem to work :-(
Sir Psycho
Did it change the behavior at all?
Justin Niessner
Sure did, things wen't crazy. Those two divs you mentioned went to the far right and below the covers div
Sir Psycho
I love CSS...you might also try keeping the float: left; on your #covers element while keeping the float: right; on the other two.
Justin Niessner
A: 

Here you go.

As a good practice, get your layout correct first before you set padding and margins.

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
    <title>Untitled Page</title>
    <style type="text/css">
        *
        {
            margin: 0;
            padding: 0;
        }
        #chooserContainer
        {
            background: #ccc;
      width: 911px;
        }

        #covers
        {
            width: 150px;
            float: left;
            height: 600px;
            overflow-y: auto;
            overflow-x: hidden;
            background-color: #0ff;
        }
        #infoBar
        {
            height: 30px;
            width: 600px;
      float: right;
      background: yellow;
        }
     #coverArea
        {
            width: 760px;
      float: right;
      background: #f60;
        }
        #actualCover
        {
            width: 794px;
            height: 600px;
        }
    </style>
</head>
<body>
    <div id="chooserContainer">
        <div id="covers">Coveres
        </div>
        <div id="infoBar">InfoBar
        </div>
        <div id="coverArea">CoverArea
            <div id="actualCover">ActualCover
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>
</body>
</html>
Virat Kadaru