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 Thursday, 7 April 2005 22:05:58 UTC