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

TD width IE problem

Status
Not open for further replies.

don2241

IS-IT--Management
Jun 1, 2001
57
AU
Hi
If I run this piece of code in Firefox it looks the way I want. How do I achieve the same result in Microsoft IE? I am referring to the width inside the <td> tags.
Thank you

<html>
<center>
<table border="1">
<tr><td colspan="2">test radio with some garbage text just for show<br></td></tr>
<tr><td width="30"><input type="radio" name="rdo173"></td><td>111</td></tr>
<tr><td width="30"><input type="radio" name="rdo173"></td><td>333</td></tr>
</table>
</center>
</html>
 
Which IE would you like to achieve the same result? Did you know center is a deprecated tag? What doctype would you like to use? How does IE not show the page the way you want? How does FF show it like you like it?

The best I can tell you is that tables are not the smartest tool to produce precise results because table cells by default ignore the width/height attributes and make sure the content fits in the cell. This can be somewhat averted by using table-layout: fixed; on the table.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
IE6 and greater (IE7), the center tag is irrelevant can be removed and still have the same outcome.

I have a table(s) which are dynamically build with data from a database. The second <tr> and the following <tr>'s will always consist of two <td>'s where the first <td> always going to be radio or checkbox. Since radio and checkbox pretty much has a static default size I want to limit the width of the <td> to just fit a radio or checkbox and then have text in the following <td>. In FF the above code does what I want but not in IE.

Rough display explanation where x= radio or checkbox
in FF
-----------------------
| x | some text |
-----------------------

in IE
-----------------------
| x | some text |
-----------------------

Hope it makes sense
 
As I mentioned above, try adding [tt]style="table-layout: fixed;"[/tt] to the table tag. That should force IE to honour the specified widths. But as I said, tables will by default expand cells to fit the content, so they're hard to work with sometimes. BTW, where are your form tags?

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
I cannot be bothered trying to fix it. I just put a new table inside the <td> and that works fine. Do not need form tags for testing purpose and sample code for this post.
 
Do not need form tags for testing purpose and sample code for this post.

Given that form elements can have default padding and/or margins in some browsers, surely you should be posting code that will emulate your real-life scenario, rather than not. Especially so given your question was regarding making your page look identical cross-browser.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top