Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Quick CSS Question 1

Status
Not open for further replies.

degroat

Programmer
Sep 15, 2003
58
0
0
US
I'm trying to buy into this whole 'death to tables' concept but it's really annoying when something that should be simple isn't when you don't use tables.

 
Okay... I didn't mean to submit the lats post, here is the question that the thread was supposed to be about....

I'm trying to set up my three columns and I want the background color of the "main" div to carry down behind the divs that are inside of the "main" div. But, I guess because I'm using absolute position on the internal divs it's not 'stretching' out the main div. How do I go about this?


<div id="main" style="width:1028px; position:relative; background:#FFF;">
<div style="width:300px; position:absolute; top:0px; left:0px;">
HERE
</div>

<div style="width:428px; position:absolute; top:0px; left:300px;">
<br><br><br>HERE2
</div>

<div style="width:300px; position:absolute; top:0px; left:728px;">
HERE3
</div>
</div>
 
Using absoluteley positioned DIVs is not recommended unless completely necessary. Which in your case isnt

For your layout try floating your divs to get the desired effect.

Code:
<div id="main" style="width:1028px; position:relative; background:#FFF;">
    <div style="width:300px; [red]float:left;[/red] top:0px; left:0px;" [blue]overflow:hidden;[/blue]>
        HERE
    </div>

    <div style="width:428px; [red]float:left;[/red] top:0px; left:300px;">
        <br><br><br>HERE2
    </div>

    <div style="width:300px; [red]float:left;[/red] top:0px; left:728px;">
        HERE3
    </div>
</div>

I also added an overflow attribute so it knows what to do with its content.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top