473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Table cell width ignored in IE6

I have a site that runs in strict mode in IE6, and IE is making <td>s
for simple two-digit numbers really wide. So I want to restrict it (and
right-align it) by using <td class="number"> and .number { width: 10px;
}. In Mozilla this works, but IE ignores this. Next to adding an
invisible "0" precding one-digit numbers, what can I do to solve this?
Jul 20 '05 #1
4 19768
"Philipp Lenssen" <in**@outer-court.com> wrote:
I have a site that runs in strict mode in IE6, and IE is making <td>s
for simple two-digit numbers really wide.
As usual, a URL would be essential, since this surely depends on various
ingredients on the page or associated with the page.
So I want to restrict it (and
right-align it) by using <td class="number"> and .number { width: 10px;
}. In Mozilla this works, but IE ignores this.


Why do you set the width in pixels? If it "worked", it could cause serious
trouble.

There's no way to say "two characters wide" in CSS. There's even no
guarantee that all digits have the same width, but this happens to be the
case in all - or at least almost all - fonts. But none of the CSS units
corresponds to the width of a character. The ex unit can be used as a coarse
guess, but for safety, I would use something like width: 2.5ex for a field
that contains two digits.

On the other hand, browsers may ignore anything you say about widths. You
can make most graphic browsers honor your widths for table cells if you set
table-layout: fixed for the table, telling that the browser should apply a
fixed algorithm for allocating the widths, using the _first_ line of the
table as the basis. But then you open a can of worms, especially if you have
used the px unit - content that doesn't fit will (by default) be omitted,
procrustinated.

So I think you should first analyze what causes the problem. Normally a
browser allocates just the needed width for a column. But if you set e.g.
width: 100% for the entire table, then the browser has a problem, and will
probably make it your problem too.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #2
Jukka K. Korpela wrote:
"Philipp Lenssen" <in**@outer-court.com> wrote:
I have a site that runs in strict mode in IE6, and IE is making
<td>s for simple two-digit numbers really wide.
As usual, a URL would be essential, since this surely depends on
various ingredients on the page or associated with the page.


The page is not yet intended for publication. I'm working on a client
and cannot show the URL (it's password-protected anyway at the moment).

There's no way to say "two characters wide" in CSS. There's even no
guarantee that all digits have the same width, but this happens to be
the case in all - or at least almost all - fonts. But none of the CSS
units corresponds to the width of a character. The ex unit can be
used as a coarse guess, but for safety, I would use something like
width: 2.5ex for a field that contains two digits.

Sounds good.
You can make most graphic browsers honor your widths for table cells
if you set table-layout: fixed for the table, telling that the
browser should apply a fixed algorithm for allocating the widths,
using the first line of the table as the basis. But then you open a
can of worms, especially if you have used the px unit - content that
doesn't fit will (by default) be omitted, procrustinated.
Exactly, I don't want to open that can. I played around with fixed
table-layout and I find it really annoying.

So I think you should first analyze what causes the problem. Normally
a browser allocates just the needed width for a column. But if you
set e.g. width: 100% for the entire table, then the browser has a
problem, and will probably make it your problem too.


Yes, currently the width is set a defined pixel value, like 615px. This
causes IExplorer to do some strange things. Maybe I can just get rid of
the width in this case. In others, I can't, because several pages
contain the table of a similar structure, but single cells carry the
same meaning and should look alike. But in this case I might just do
that, let the width be automatically adjusted to the content. Will see
if the art director or client likes it though!
Jul 20 '05 #3
Philipp Lenssen wrote:
The page is not yet intended for publication. I'm working on a client
and cannot show the URL (it's password-protected anyway at the moment).


You could give us the source code or a link to the source code. We don't
need images to check if it is correct ;-)

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #4
Philipp Lenssen wrote:
Jukka K. Korpela wrote:


So I think you should first analyze what causes the problem.
Normally a browser allocates just the needed width for a column.
But if you set e.g. width: 100% for the entire table, then the
browser has a problem, and will probably make it your problem too.


Yes, currently the width is set a defined pixel value, like 615px.
This causes IExplorer to do some strange things. Maybe I can just get
rid of the width in this case. In others, I can't, because several
pages contain the table of a similar structure, but single cells
carry the same meaning and should look alike. But in this case I
might just do that, let the width be automatically adjusted to the
content. Will see if the art director or client likes it though!


OK, I'm afraid the auto-width isn't acceptable from a layout POV. Will
have to figure out something else... actually, like I said, Mozilla is
doing just fine -- I have some cells which have an auto-width, and some
which have a fixed width, so why shouldn't the browser be able to
figure out to have the auto-width cells occupy what's left over of the
width?
Jul 20 '05 #5

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

Similar topics

2
by: LC's No-Spam Newsreading account | last post by:
I have a form arranged in a table (you can see an example in the page http://cosmos.mi.iasf.cnr.it/~lssadmin/Website/LSS/Help/query.html) The table is on three columns but has a structure like...
5
by: Ivo | last post by:
Consider a table with a number of rows, each containing a short text (label) on the left and an input control on the right. Some inputs are of type text and others of type checkbox. I would like...
1
by: MattB | last post by:
Hello please help, I have a table cell with a div in it. The div has a width of 300px. but when it is rendered it puts extra space into the table cell. Here's the style <style>...
3
by: RBalbat | last post by:
Hello all, I have encountered an unexpected problem where if I render a table (in IE or Opera) and there are cells that contains URLs with long query strings, even though I specify the table...
1
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say...
1
by: Jeronimo Bertran | last post by:
I am creating a table and inserting an iframe inside a cell for which the width depends on the screen size. The table has 7 columns and the fourth column is resized depeding on the screen...
2
by: Dot net work | last post by:
Hello. Is it possible to build up a dynamic server side table, and specify the column widths as percentages? I've tried this: Set the table width to 100%, then: FirstColumn.Width = New...
0
by: Thomas Scheiderich | last post by:
I have a table that has 3 image slices. The middle slice changes size based on size of browser window. This works great. My client wants the date to show over the image on the right. So what I...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.