Style Sheets
In general, I am completely against Style Sheets.
This is just another poorly thought out level of complexity
which makes it harder for content developers to control
the display of their product.
To quote from
the Web Design Group
Style sheets represent an enormous step forward for the Web.
With the separation of content and presentation between HTML
and style sheets, the Web no longer needs to drift away from
the strong ideal of platform independence that provided the
medium with its initial push of popularity. Authors can finally
influence the presentation of documents without leaving pages
unreadable to users.
The last thing I want to do is to loose control over how my
page is presented.
As far as platform independence,
if UNIX is only 2% of the market, why should that
be the primary driving force?
The biggest problem with UNIX is that it reminds me of
DOS on an XT.
If it can't keep up with new ideas, then don't support it! :)
This example shows one advantage to style sheets.
I have a table of test cases which are either
Pass, Fail, or Not tested.
It is useful to indicate this with different colors.
However, on a normal laser printer
italic and strike out are needed to see the differences.
The following style definitions are in the heading of this document.
<STYLE type="text/css">
td.p {color: green; font-style: italic}
td.f {color: red ; text-decoration: line-through }
td {color: black }
</style>
They are invoked by
<td class=p>
<td class=f>
<td class= >
31 | fb | fa | be | Description
|
2171 | 683 | 1464 | 2287 | Test case 1
|
2176 | 684 | ---- | ---- | Test case 2
*** IE 3.02 font control failure - THIS SHOULD BE RED
|
2176 | 685 | ---- | ---- | Test case 3
|
<td class=p>683<td>
uses a little less space than the more traditional
<td><font color=green><i>683<td>
And it allows you to control the look of the page by just modifying
a few lines verses changing every line in a table.
However, it requires a browser with styles turned on.
In addition, there as an unexpected side affect -
in IE 3.02,
the <font color=red> tag won't work in the table as
long as style sheets are enabled.
(Of course IE 4.40 and Netscape Comunicator 4.05 render it correctly :)
When the style sheets are disabled, then it works.
The following line is copied from the table to here.
Like I said earlier, styles are not thought out very well.
Use with caution.
(BTW, IE 4.40 incorrectly handles the <br> after
Test case 2 and places the next line in column 1
instead of column 5.)
Browser Dependencies
IE 4.72 and Netscape Communicator 4.05 do not support style names
which contain underscores.
IE 5.0 does allow underscores.
| IE 4.72 | IE 5.0 | Netscape 4.05
|
---|
table_bg | Fail | OK | Fail
|
tablebg | OK | OK | OK
|
Netscape Communicator 4.01a has a problem with <p>.
It appears that </p> is required in various situations,
particularly inside tables.
This is particularly true when the table is inside a
<div> block which is hidden via style sheets,
though I've seen it both ways.
(According to the standards, </p> is never required.)
In Dynamic HTML, Java Script can be used to hide and display
sections in a namded block.
However, Netscape Communicator 4.01a requires that a style sheet
entry defines the
position: absolute;
What web-text really needs is
- The ability to place multiple pages in a single file
for printing and searching while maintaining the ability to display
the data as separate pages.
- The ability to control page breaks when printing -
CSS solution here.
- The ability to orient a page as either portrait or landscape
when printing.
CSS solution here.
- The ability to define simple macros with 1 and 2 letter names
(such as <tp> instead of <td class=p>).
- Tags for indent, tab, and tab set
References
- The Web Design Group
has tutorials and has a
single page description
which is much easier to search than the W3C page.
- The HTML 4.0 Reference Specification section on
Style Sheets may be complete, but it is difficult to search
since it is broken up into several parts.
- This reference provides a summary of various tags and
identifies which browsers they don't work in.
- ZDNet provides several articles on style sheets
including
- This very well written page
explains why CSS is better than <font> tags.
There are lots of examples.
- HTML Goodies explains how to use CSS to
control page breaks when printing.
Notice that strike out has been re-named line-through.
With standards like this, who needs enemies? :)
Author: Robert Clemenzi -
clemenzi@cpcug.org