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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Floats for tables

Status
Not open for further replies.

JontyMC

Programmer
Nov 26, 2001
1,276
GB
OK. I'm replacing a table with div's. I have 3 div's that that I've floated left so they are all lined up. How do you stop them breaking up when the browser window is made smaller. I want them to all stay on the same line like a table would.

Cheers,

Jon
 
If they have fixed width (ie not something that is scaled down when the viewport becomes smaller) the only way to do it is embed them into another element that has a fixed width:
Code:
<div style="width: 500px;">
 <div style="float: left; width: 100px; background: red;"></div>
 <div style="float: left; width: 350px; background: blue;"></div>
 <div style="float: left; width: 50px; background: yellow;"></div>
</div>
This will stay fixed in their locked container. Without the locked container or relative widths, you cannot do that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top