Forum Moderators: open
Thks
If you're willing to spend the time to completely rebuild your entire site, you can make CSS positioning work on all major version 4+ browsers... but if you'd like to keep the rest of your site "as is," you're better off sticking with your spacer.gif.
IE is very forgiving but Netscape will give headaches.
Its more a personal thing with me as I get sick of seeing sites using about 50 transparent GIFs to set up a simple table.
Most problems can easily be avoided with a little pre thought and effort though rather than letting a prog like fireworks "help" you. (not that i hate firworks, in fact I love it....just not for creating tables)
So what is a nice backwards compatible alternative? Style and the Netscape redundant spacer tag. You have to use the type=block and include both height and width. Here are 3 examples
<td style="width:10px;"><spacer type="block" height="1" width="10"></td>
<span style="width=10px;"><spacer type="block" height="1" width="10"></span>
<td style="height:20px;width:20px;">;"><spacer type="block" height="20" width="20"></td>
It's clean and works IE3+, Netscape 4+.
So, please, please, please stop using spacer.gif.
Now, can you explain the difference between the three formats of the tag? Is there a benefit of using one over the other?
What would the tags look like if there were rowspan and colspan attributes?
Essentially the spacer is the same as spacer.gif when used in Netscape. Provided your table cells have the same height and width as the spacer then they will be identical across browsers, regardless of colspans and rowspans. Given that IE uses style sheets back to version three I've used style references rather than <td height=20 width=20> but that works just as well.
After changing the spacer.gif tags to the above method, I now get these errors. Help?
... th:151px;height:1px;"><spacer type="block" width="151" heigh ...
^Error: there is no attribute "TYPE" for this element (in this HTML version)Line 18, column 35:
... t:1px;"><spacer type="block" width="151" height="1"></td>
^Error: there is no attribute "WIDTH" for this element (in this HTML version)Line 18, column 50:
... ght:1px;"><spacer type="block" width="151" height="1"></td>
^Error: there is no attribute "HEIGHT" for this element (in this HTML version)Line 18, column 50:
... :1px;"><spacer type="block" width="151" height="1"></td>
^Error: element "SPACER" not defined in this HTML versionLine 18, column 50:
... "><spacer type="block" width="151" height="1"></td>
^Error: end tag for "SPACER" omitted; possible causes include a missing end tag, improper nesting of elements, or use of an element where it is not allowed.
so the complete example (with colspan)
<td colspan="2" style="height:20px;width:20px;"><spacer type="block" height="20" width="20"/></td>
Its people like you that keep me awake all night! :)