tags:

views:

32

answers:

2

take a look at this Code. i want the Left & Right Box (DIVs) to appear in one line.. how to do it

+1  A: 
<div><div style="float:left">a</div> <div style="float:left">b</div></div>
<div style="clear:both"></div>
Orbit
i did this, but now my borders are not aligned in a straight line http://jsfiddle.net/ayqyn/
Junaid Saeed
A: 

Float both the left and right divs to the left and clear the footer. You will also need to adjust the widths of the left and right divs for them to fit on the same line.

#left
{
    position:static;
    width: 40%;
    height: 50px;
    margin-top: 10px;
    margin-right: 10px;
    background: #111111;
    border: solid 3px #ff0000; 
    float: left;
}

#right
{
    position:static;
    width: 40%;
    height: 50px;
    margin-top: 10px;
    margin-right: 10px;
    background: #111111;
    border: solid 3px #ff0000;
    float: left;
}

#footer
{
    position: static;
    width   : 100%;
    height  : 50px;
    margin-top: 10px;

    background: #111111;
    border: solid 3px #ff0000;
    text-align: center;
    clear: both;
}
CuriousCurmudgeon
i did, but now my borders are not aligned in a straight line http://jsfiddle.net/ayqyn/
Junaid Saeed
You are setting the width of the header to 100%, which is 300px. When you then add the border it is added to the outside of this div. This means that the actual width of your header is 300 + 2*3 = 306px. You will need to decide if you want your borders within the container or not and adjust your widths accordingly.
CuriousCurmudgeon