RE: Inline Style Sheet Question

Thanks for everyone's feedback. I guess I should've given more of an
explanation of why I wanted to use different colors. I have a sentence
that says: "* indicates a required field", where the * will be red.
Throughout the page (and web site) the * will be next to required form
elements.  I will either use the <strong> or <em> tag to format the *.  

Thanks again for all of the responses.  


    

-----Original Message-----
From: w3c-wai-ig-request@w3.org [mailto:w3c-wai-ig-request@w3.org] On
Behalf Of David Woolley
Sent: Thursday, April 07, 2005 6:06 PM
To: w3c-wai-ig@w3.org
Subject: Re: Inline Style Sheet Question


> 
> Sorry this may be my lack of knowledge on style sheets, but what if
> there is one word in the paragraph that needs to have a different
style?

That depends on why it needs to have a different style.  In most cases
you will make it into an appropriate inline element, e.g. strong, em, 
cite, etc.  If there really is no standard element, first consider
whether
the styling is gratuitous, and if not use a span element.

> But by default the <p> tag creates a break after the closing </p>. So
if

A p element contains a paragraph, it should not be used purely for its
styling effects.

P {
      Color: red;
}
P EM {
      Font-weight: bold;
}

<p>here is my <em>paragraph</em>.</p>

> I understand that I could use a <span> tag around the word
'paragraph'.

You can't use a tag around anything, but you can use an element.

> But how would I use the style sheet if it is an abuse of style sheets
to
> create my own class (ex. .red)?

The abuses are in:

- using span when there is a more specific inline element;

- naming classes after the intended presentation, rather than what that
  presentation signifies.

If you replaced red by danger, you might have a valid use of span, but
you would first have to be sure that it would not be better to use
<strong class="danger">.....</strong>, or similarly with em.

Received on Friday, 8 April 2005 00:39:45 UTC