In our last episode,
<c5**********************************@2g2000hsn.go oglegroups.com>, the
lovely and talented Clive Backham broadcast on
comp.infosystems.
www.authoring.html:
I need to set up forms where some input fields are mandatory and
others are optional. A common convention is to place an asterisk on
the labels of the mandatory fields. Of course, I can just hard code
these asterisks, but I'd have thought it would be better to use a CSS
element to control how a mandatory field should be marked. For example
(using a table to lay out the fields):
><tr><td class=mandatory>Label 1:</td><td><input ....></td></tr>
<tr><td class=optional>Label 2:</td><td><input ....></td></tr>
I cannot find out how to set up a CSS element so that a piece of text
is added to the content.
You cannot use CSS to add text to an element. You could use CSS to display
(or not) text that is already there:
<tr><td class=mandatory><span>*</span>Label 1:</td><td><input ....></td></tr>
<tr><td class=optional><span>*</span>Label 2:</td><td><input ....></td></tr>
..optional SPAN { display: none; }
In this case, you hide the asterisk for optional fields. But the asterisk
is in the text and will show in text browsers or when CSS is off.
There are also various tricks you can do with images, such as adding an
image with an asterisk as background to elements that are mandatory. This
too breaks more-or-less horribly in text browsing and requires special
attention if the page is to be printed successfully.
In both cases, CSS did not add text. In one case it hid text. In the other
it added a background image. CSS cannot alter the text.
(I realise it can be done with the :BEFORE pseudo-element, but it
doesn't work in IE6, which is the primary browser amongst users of
this site).
Any suggestions gratefully received.
--
Lars Eighner <http://larseighner.com/
us****@larseighner.com
Love: The warm feeling you get towards someone who meets your neurotic needs.