Jump to content

Is this how CSS is meant to behave? Floating tables.


cs.punk

Recommended Posts

.div1 {
float: left;
border: solid 2px #CC6644;
}

table {
float: left;
}

 

As soon as the table contains a row that spans over one line, the table goes below the div. Unless you remove the float from table {}.

 

Using Firefox 3.5. Works fine in IE 7.

Link to comment
Share on other sites

Sorry guys..

 

CSS

.div1 {
border: solid 2px #CC6644;
float: left;
}

table {
float: left;
}

 

XHTML

<div class='div1'>
<p>test test test </p>
</div>

<table border='1'>
<tr>
 <th>Title</th>
 <th>Test</th>
</tr>
<tr>
 <td>test test test test test test test test test test test test test test test test test 
	 test test test test test test test test test test test test test test test test 
	 test test test test test test test test test test test test test test test test
</td>
 <td>2</td>

</tr>
</table>

 

With this code the table does not 'float against' div1 (fig 1) ONLY once I remove the float from table* does it float normally (fig 2).

 

*

table {

}

This happens in firefox, in IE it works perfectly.

 

[attachment deleted by admin]

Link to comment
Share on other sites

just tested and it does float. if u dont set a width how will u know if it is floating or not lol

 

<style type="text/css">
.div1 {
border: solid 2px #ff0000;
float: left;
margin:10px;
}

table {
float: left;
width:600px;
color:#ff0000;
}

</style>
<div class='div1'>
<p>test test test </p>
</div>

<table border='1'>
<tr>
 <th>Title</th>
 <th>Test</th>
</tr>
<tr>
 <td>test test test test test test test test test test test test test test test test test 
	 test test test test test test test test test test test test test test test test 
	 test test test test test test test test test test test test test test test test
</td>
 <td>2</td>

</tr>
</table>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.