473,756 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE7 table float problem


Using IE7, I'm trying to display a table in a horizontal manner by
floating the rows.
The following html does not work, displaying the table vertically as if
the rows were not floated.
This same html does work correctly in firefox.

<table style="width: 100%">
<tr style="float: left">
<td>col1</td>
</tr>
<tr style="float: left">
<td>col2</td>
</tr>
</table>

Does someone has any idea why and how to correct it ?

Thanks in advance
Aug 7 '07 #1
3 5553
On 2007-08-07, Harry <wrote:
Using IE7, I'm trying to display a table in a horizontal manner by
floating the rows.
This is an extraordinary idea, but it is actually defined what is
supposed to happen, although it might not be in the way you were
expecting.
The following html does not work, displaying the table vertically as if
the rows were not floated.
This same html does work correctly in firefox.
><table style="width: 100%">
<tr style="float: left">
<td>col1</td>
</tr>
<tr style="float: left">
<td>col2</td>
</tr>
</table>
Does someone has any idea why and how to correct it ?
When you set float: left on a tr, it stops being display: table-row and
become display: block (CSS 2.1 9.7).

That means this table has no table-rows from the CSS point of view. But
as far as the HTML parser is concerned, it is OK, and is therefore not
"repaired".

This means you end up in section 17.1.2 of CSS 2.1 ("Anonymous table
objects"). What that does is create an anonymous table row box and table
cell box around the two floats since they appear directly inside a table
without a cell or a row.

Having done that, each td is now orphaned, so each one now needs its own
whole new anonymous table and tr.

So you end up with this structure of CSS boxes:

table
anon table-row
anon table-cell
float
anon table
anon table-row
anon table-cell
col 1
float
anon table
anon table-row
anon table-cell
col 2

So the outer table only has one cell, with two floats in it, each
containing another table. The floats should go side-by-side in their
cell if there is enough room, which is hard to tell in your case because
all we know is "width: 100%".

So who knows where the problem is in IE7, perhaps it doesn't implement
17.1.2 properly at all. After all you don't often get there unless you
use the display: table-row etc. properties (which I don't think IE7
supports) or change the value of display on elements like <tableand
<trwhich is what you're doing implicitly by floating them.

How to correct it? It's difficult to know. But table rows go one
underneath the other _in all the browsers_, it's just that the HTML
you've written is generating a lot more CSS boxes than it might look
like it is. If you need side-by-side table rows, you need to put them in
separate tables, which is what conforming browsers effectively do for
you with this input.

So I think you're likely to avoid the problem if you don't set float on
table-rows (or table-cells). Put each of those rows in separate tables
explicitly and then float the tables.
Aug 7 '07 #2
In article <sl************ *********@bowse r.marioworld>,
Ben C <sp******@spam. eggswrote:
On 2007-08-07, Harry <wrote:
Using IE7, I'm trying to display a table in a horizontal manner by
floating the rows.

This is an extraordinary idea,
As is brilliant the analysis you follow up with...

--
dorayme
Aug 7 '07 #3
Ben C wrote:
So I think you're likely to avoid the problem if you don't set float on
table-rows (or table-cells). Put each of those rows in separate tables
explicitly and then float the tables.
Ben: thanks for your explanation, and I'll look into your suggestion
very seriously indeed.
I find CSS wonderful in theory but a mine-field in operation.
Aug 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5285
by: T | last post by:
I am attempting to create a menu using <div> and <span> tags within a table cell. When the page loads, some of the classes don't seem to be applied. If I hover over the menu everything is fine from that point on. If I remove the table everything renders correctly, and I have no problems. Unfortunately, I need to nest this menu within a table. I am currently having this problem in IE 6. Thanks in advance for the help! <html>...
1
2125
by: Robert | last post by:
I created two pages. One using CSS and the other using a table. I'd like the css version to work like the table version. The problem arises when the full image doesn't fit in the window. Click on the moon thumb to see the problem. In IE 5.2 on MacOS 10.2.6, the moon drops down below the list of thumbs. I'd like it to say to the right of the thumbs and be able to scroll right. In Netscape 7.2, the larger image of the moon stays to...
0
1747
by: phil_gg04 | last post by:
Hi CSS Experts, I'm suffering from the known Internet Explorer "3 pixel offset next to a float" problem - see for example http://www.positioniseverything.net/explorer/threepxtest.html. Unfortunately, in my case, I haven't managed to make it go away using any of the techniques I've found. The difference is that I have a full-width table in the content next to the float. Here's the test code:
3
1504
by: Astra | last post by:
Hi All I'm really stuck on this one so would appreciate any help you can give. In essence, I have 1 SQL 2000 table with rows of data logging stock movement. To differenciate between a stock sale and a stock receipt the table has a TRANSACTIONTYPE field so that 8,7 equal invoices and 3 equals a receipt. I've been asked to report on this data by suming the total qty used on
9
1837
by: Jimakos Bilakis | last post by:
Hi everyone! I want to create a function that it will take as parameters a table (float), an integer (the number of Table's rows) and it will re-arrange the elements in the table from the smallest value to the biggest one. I know it's very simple but something is missing from my code... Untill now i manage to create something like this: 1. void FunctionReArrange (float Table, int TableRows) 2. {
8
3181
by: Gianni Rondinini | last post by:
hi all, i'm here again. i couldn't find/understand this on w3c css2 recommendation and documentation, then here i ask. i decided to still use some tables in my pages for some forms. i played around with divs and whatever else for some time, but getting things done correctly across multiple browsers requires too much time. with tables, things come pretty easy and, since i'm using these only inside our company, this is 100% ok. i mean:...
0
1444
by: h2reyes | last post by:
I have the following query: select sq.*, p.numero, p.nombre from paf p right outer join dbo.GetListOfSquaresForShippingLot(@lot) sq on sq.number = p.numero and sq.version = p.numero The @lot parameter is declared at the top (declare @lot int; set @lot = 1;). GetListOfSquaresForShippingLot is a CLR TVF coded in C#. The TVF queries a XML field in the database and returns nodes as rows, and this is completed with information from a table. ...
1
2688
by: rsteph | last post by:
I've got a page with a menu div that is 1066px wide by 150px high. And then I have some images that are 150px by 150px for the menu items. I put the images in a table that is set to 150x150px with a 1px border around the table, and around each cell in the table. For some reason though, a space is appearing inside the table, below the images. I've made the menu div background color red, so that it is obvious what's happened. I've also resized...
7
15694
by: Allie | last post by:
Here's an example of what I'm trying to do: <table> <tr style="text-align:left; font-size:10pt; font-weight:bold"> <!-- I want this word to align to the left --> ' ||CRPT|| ' <!-- I want this link to align to the right --> <A HREF=" REPORT?v_rpt='|| v_rpt ||'&v_printable=1'||'">Printable</A> </tr>
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.