Bree 0

----mistakenly posted this to SO, in case you saw this there---------

Hi,

I don't know why, after encountering this problem dozens of times, the answer always seems different and I can't seem to work my way through the problem-solving process, but here I am again with misaligned divs.

I've got 3rows encasing columns. each row is to have (at least) 3 columns (and probably some nested divs down the line, but I'm not even there yet). I'm trying to make a fluid chunk in the center ultimately, with pretty corners. However, my top row is already showing signs of misbehaving. >.O

Please help with my silly questions!

Cheers and thanks in advance!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<style type="text/css">

#wrap {
    margin:auto;
    width:80%;
    height:75%;
    border: solid #066 1px;}

#row1 {
    width:100%;
    height:10%;
    background:#F20;
    }
    #r1c1 {
        float:left; 
        width:05%;}
    #r1c2 {
        float:left; 
        width:80%}
    #r1c3 {
        clear:both;
        width:05%;
        }


#row2 {
    float:none;
    width:100%;
    background:#0C6;
    }   
#r2c1 {}
#r2c2 {}
#r2c3 {}



#row3   {
    width:100%;
    height:15%;
    background:#00F;
    clear:both;
    }
#r3c1 {}
#r3c2 {}
#r3c3 {}



</style>

<body>

<div id="wrap">
<div id="row1"> 
    <div id="r1c1">LEFT</div>
    <div id="r1c2">CENT</div>
    <div id="r1c3">RIGHT</div>
    </div>

<div id="row2"> 
MIDDLE
    </div>

<div id="row3"> 
BOTTOM
    </div>


</div>
</body>
</html>

3 answers

0
points

Your r1c3 div is set to clear both. That means nothing can be on either side of it, which is pretty much what it's doing.

Answered over 6 years ago by Nathan Duran
  • Ahah! So I set it to...right! right? Sometimes I wonder how I can still tie my shoes... Bree over 6 years ago
  • Oh no, that didn't work :( Bree over 6 years ago
  • No, that's not what it means at all. http://articles.sitepoint.com/article/properties-glance-guide/2 Nathan Duran over 6 years ago
Bree 0
0
points

Can someone else help please?

Tried removing the clear, that made it all bunch up. Tried setting clear to right or left, and no dice.

Answered over 6 years ago by Bree
edl 0
0
points

There might be a better answer out there, but I would nest another div like so:

<div id="wrap">
<div id="row1"> 
    <div id="r1c1">LEFT</div>
    <div id="r1sub">
        <div id="r1c2">CENT</div>
        <div id="r1c3">RIGHT</div>
    </div>
</div>

and:

#wrap {
margin:auto;
width:100%;
height:75%;
border: solid #066 1px;}

#row1 {

width:100%;
height:10%;
background:#F20;
overflow:auto;
}
#r1c1 {
    float:left;
    width:10%;}
#r1sub {
    float:right;
    width:90%;}
    #r1c2 {
        text-align:center;
        width:80%;
        position:absolute;
        float:left;}
    #r1c3 {
        text-align:right;
        float:right;
        width:10%;}

cant get the code to display properly because I must be retarded, but you get the idea.

Answered over 6 years ago by edl