/    Sign up×
Community /Pin to ProfileBookmark

Prevent relative width divs from wrapping

Hello,

I have a bunch of divs floating left (so that they line up). They are given relative widths and are in a container that contains a relative width. The following is an example

[CODE]
<HTML>
<HEAD>
<style type=”text/css”>
div.container{
width:100%;
}

div.one{
float: left;
width:30%;
border: 1px solid blue;
}

div.two{
float: left;
width:20%;
border: 1px solid green;
}

div.three{
float: left;
width:30%;
border: 1px solid red;
}

div.four{
float: left;
width:19%;
border: 1px solid black;
}

table.full{
width:100%;
}
</style>
<TITLE>TEST</TITLE>
</HEAD>
<BODY>
<div class=”container”>
<div class=”one”>
<table class=”full”>
<tr>
<th>Purchase Date</th>
<th>Item</th>
<th>Cost</th>
</tr>
<tr>
<td>January 10, 2009 11:55 am</td>
<td>Mitre saw with guiding laser</td>
<td>$120.99 </td>
</tr>
<tr>
<td>January 12, 2009 2:32 pm</td>
<td>55 inch plasma television</td>
<td>$1500 </td>
</tr>
<tr>
<td>January 12, 2009 2:32 pm</td>
<td>Blu ray home theatre system with surround sound</td>
<td>$650 </td>
</tr>

</table>
</div>
<div class=”two”>
This is another div. Yup….just another div

More details
More details
More details
More details
More details
More details
More details

</div>

<div class=”three”>
A third div
</div>
<div class=”four”>
A third div
</div>
</div>
</BODY>
</HTML>
[/CODE]

Is there a way to prevent the wrapping? I know that I can do so by specifying a hardcoded width, but I really do not want to do that.

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@FangJan 20.2010 — Adding a min-width will allow the use of the scrollbar
body {min-width:50em;}
Copy linkTweet thisAlerts:
@crazy_coderauthorJan 20.2010 — But min-width is not supported in IE6. And can min-width take percentages?
×

Success!

Help @crazy_coder spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...