|
-
Jul 6th, 2002, 10:39 AM
#1
Thread Starter
Addicted Member
Can get my HTML tables to render correctly.
Code:
<table border="1" width="400" height="200">
<tr>
<td width="20" > One </td>
<td width="20" > Two </td>
<td width="20" > Three </td>
<td width="20" > Four </td>
<td > Padding </td>
</tr>
<tr>
<td colspan="5">Not much text!</td>
<!-- <td colspan="5">There is quite a lot of text here...and it messes up the table :(</td> -->
</tr>
<tr>
<td colspan="5">Test</td>
</tr>
</table>
Stick this code in an html file and view it...that is how is should look. The first four cells are small and the forth fills up the width.
Now comment the first bold line and uncomment the second. Now the width of the cells on the first row are buggered WTH is happening?
I am using IE 6 btw.
-
Jul 6th, 2002, 02:16 PM
#2
Frenzied Member
Looks fine to me in IE 6.
-
Jul 6th, 2002, 03:35 PM
#3
Thread Starter
Addicted Member
That is wrong, the first four cells are too wide...they should be about half that width.
The two tables should look the same:
-
Jul 7th, 2002, 05:54 AM
#4
Frenzied Member
Oh yeah I see, sorry. Are you allowed to add "px" to the width attributes, I can't remember? Maybe that would fix it. IE is buggy with a lot of things it does, and I assume this is another one of its bugs. Is it alright in Mozilla/Netscape/Opera?
-
Jul 7th, 2002, 06:50 AM
#5
Thread Starter
Addicted Member
I don't have Mozilla/Netscape/Opera, but the page will be viewed using IE 99% of the time. Maybe I can replace the 5 columns in the first row with another table. Silly IE
-
Jul 7th, 2002, 08:15 AM
#6
Frenzied Member
I don't know exactly what you want, but maybe you would be better off using CSS and DIVs, there's a good chance you could solve this problem then.
-
Jul 7th, 2002, 08:35 AM
#7
Thread Starter
Addicted Member
I am already using CSS...same problem...I'll give divs a try but I am not sure if they'll do what I want...
-
Jul 7th, 2002, 08:43 AM
#8
Thread Starter
Addicted Member
I think i'll have to use spans instead.
Last edited by Martin Wilson; Jul 7th, 2002 at 08:58 AM.
-
Jul 7th, 2002, 12:50 PM
#9
Frenzied Member
You could try something like this with DIVs, it seems to get rid of the problem:
Code:
<head>
<style type="text/css"><!--
.cell, .cell2 {
border:1px solid black;
}
.cell2 {
float:left;
width:20px;
}
.table {
border:1px solid black;
}
--></style>
</head>
<body>
<div class="table">
<div class="cell2">One</div>
<div class="cell2">Two</div>
<div class="cell2">Three</div>
<div class="cell2">Four</div>
<div class="cell">Padding</div>
<div class="cell">There is quite a lot of text here... does it still mess up the "table"?</div>
<div class="cell">Test</div>
</div>
</body>
The only problem is (if you don't want this effect that is), is that if the browser is too small the "cells" break down a line. I'm sure there is a work around though.
-
Jul 12th, 2002, 03:54 PM
#10
Thread Starter
Addicted Member
I found a fix:
table-layout: fixed;
That stops IE doing what it wants and solves all the problems
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|