W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > April to June 2005

RE: Inline Style Sheet Question

From: Beheler Kim <beheler_kim@bah.com>
Date: Thu, 7 Apr 2005 20:39:31 -0400
Message-ID: <CD6921F5E4AC7842B574B14C4E48A8CB4E3ADF@MCLNEXVS03.resource.ds.bah.com>
To: <w3c-wai-ig@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 July 2011 18:14:21 GMT