|
Posted by BT on March 30, 2005, 7:13 pm
Please log in for more thread options
I inherited a simple page that needs to be Strict HTML and I'm not very
familiar with this standard. What I'm trying to do _should be_ pretty
simple so I hope someone can point me in the right direction.
I'm trying to make a table with 2 columns split down the middle - simple
enough. In the past, without Strict HTML, I would just specify the width of
each 'cell' as 50%, but width isn't allowed in a <td> under Strict HTML.
Sometimes I would make these 2 cells 45% with a 10% cell between them to
make the spacing more readable. If I just remove the 'width' attribute',
the browser splits the screen width differently depending on what's in each
cell. Unfortunately, I need to match a format where the table is split down
the middle.
Is there a simple way to control the width of the columns in my tables when
using strict HTML??
many thanks, BT
|
|
Posted by Del Ferguson on March 30, 2005, 11:54 am
Please log in for more thread options
BT,
Strictly my version as follows. Passes XHTML validation. Looks OK in
either FF or IE. Control colors, background, etc., with CSS.
Del Ferguson
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
<title>Test Table</title>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="5" summary="Test
Table">
<colgroup span="2">
<col width="50%" />
<col width="50%" /></colgroup>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
>I inherited a simple page that needs to be Strict HTML and I'm not very
>familiar with this standard. What I'm trying to do _should be_ pretty
>simple so I hope someone can point me in the right direction.
>
> I'm trying to make a table with 2 columns split down the middle - simple
> enough. In the past, without Strict HTML, I would just specify the width
> of each 'cell' as 50%, but width isn't allowed in a <td> under Strict
> HTML. Sometimes I would make these 2 cells 45% with a 10% cell between
> them to make the spacing more readable. If I just remove the 'width'
> attribute', the browser splits the screen width differently depending on
> what's in each cell. Unfortunately, I need to match a format where the
> table is split down the middle.
>
> Is there a simple way to control the width of the columns in my tables
> when using strict HTML??
>
> many thanks, BT
>
|
|
Posted by kaeli on March 30, 2005, 1:48 pm
Please log in for more thread options
enlightened us with...
>
> Is there a simple way to control the width of the columns in my tables when
> using strict HTML??
>
td.half {width: 50%; padding-left: 5px; padding-right: 5px;}
....
<td class="half">
Even better, class the table and provide CSS for the whole thing.
Strict requires separation of presentation and content. You have to use CSS.
Like so...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
table.even {
width: 85%;
border: 1px solid #686868;
border-collapse: collapse;
}
table.even TH{
font-weight: bold;
text-align: center;
border: 1px solid #686868;
border-collapse: collapse;
padding: 0px;
margin: 0px;
}
table.even TD{
width: 50%;
border: 1px solid #686868;
border-collapse: collapse;
padding-left: 5px;
padding-right: 5px;
padding-top: 0;
padding-bottom: 0;
margin: 0px;
}
</style>
</head>
<body>
<table class="even">
<tr>
<th>header 1</th>
<th>header 2</th>
</tr>
<tr>
<td>data</td>
<td>more data</td>
</tr>
<tr>
<td>yet more data</td>
<td>and more</td>
</tr>
</table>
</body>
</html>
--
--
~kaeli~
A backward poet writes... inverse.
http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
|
|
Posted by c.thornquist on March 30, 2005, 7:30 pm
Please log in for more thread options
>I inherited a simple page that needs to be Strict HTML and I'm not very
>familiar with this standard. What I'm trying to do _should be_ pretty
>simple so I hope someone can point me in the right direction.
>
> I'm trying to make a table with 2 columns split down the middle - simple
> enough. In the past, without Strict HTML, I would just specify the width
> of each 'cell' as 50%, but width isn't allowed in a <td> under Strict
> HTML. Sometimes I would make these 2 cells 45% with a 10% cell between
> them to make the spacing more readable. If I just remove the 'width'
> attribute', the browser splits the screen width differently depending on
> what's in each cell. Unfortunately, I need to match a format where the
> table is split down the middle.
>
> Is there a simple way to control the width of the columns in my tables
> when using strict HTML??
>
> many thanks, BT
>
Don't know much about "strict" standards, but sometimes I place a row above
or below with transparent .gifs 1 pixel high in the cells. Then set the
width of the .gifs accordingly. Makes all the columns above or below exactly
as you specified in those .gifs. Adobe's Image Ready does then same thing
when you slice an image.
Will your table borders be set to "0"? If so, you won't even see the row of
..gifs.
Carla
|
|
Posted by Barbara de Zoete on March 30, 2005, 9:44 pm
Please log in for more thread options
wrote:
>
>> Is there a simple way to control the width of the columns in my tables
>> when using strict HTML??
>>
> Don't know much about "strict" standards, but sometimes I place a row above
> or below with transparent .gifs 1 pixel high in the cells. Then set the
> width of the .gifs accordingly. Makes all the columns above or below exactly
> as you specified in those .gifs. Adobe's Image Ready does then same thing
> when you slice an image.
How on earth is a spacer.gif ever going to be tabular data? If you think abusing
spacer gifs in layout tables is fine for your purposes, please keep using them,
but pointing others down that horrible faulty road is not much appreciated.
OP should really just read on tables in the w3c specs. There he'll find that in
html strict using the elements colgroup and col give good control over column
width, if it needs to be set by author. In almost all situations tabular data
will shrink or stretch a table columns width as needed, so there is no use for
setting the width by author.
--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
|
| Similar Threads | Posted | | Gap Above Table with Strict Doctype | December 14, 2004, 1:27 pm |
| Differences between HTML 4.01 Strict and HTML 4.01 Transitional? | May 31, 2005, 7:13 pm |
| xhtml vs html 4 strict | May 21, 2005, 5:23 pm |
| Preloading audio - possible in HTML 4 Strict | January 11, 2005, 10:36 am |
| HTML 4.01 strict / transitional vs. XHTML 1.0 | September 18, 2005, 3:10 pm |
| Document seems invalid, but validates as HTML 4.01 strict | September 4, 2008, 3:01 pm |
W3C Validator error? is valid for doctype HTML 4.01 Strict | April 21, 2005, 12:46 pm |
| Strict HTML: mimic target tag/favicon location? | October 4, 2008, 6:32 am |
| Strict HTML: mimic target tag/favicon location? | October 5, 2008, 1:44 pm |
| html table prolem | February 6, 2006, 4:39 pm |
|