Search code examples
htmlcsslayoutsemantics

Styling a salutation


I am having a mental block!!

  1. is "Dear Sir" known as a salutation? I think this is what my css class will be called

  2. Semantically speaking, should the salutation be a span, p or something else completely!

I'm leaning towards span, but wondered if anyone else had a spare 2 cents.

Many thanks


Solution

  • You should use <span> for an inline element.

    Also, how about trying the :first-line pseudo-element? It will style the first line of a paragraph (assuming your salutation is the first line). For example:

    p:first-line {
        font-size: 120%;
    }
    

    Here's a jsfiddle demonstrating that