This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Inline Elements [Aug. 17, 2011, 1:57 a.m.]


HTML uses inline elements to mark data such as citations, computer code, images, and links. Inline elements cannot be placed directly in the <body> but should be nested within a block element, such as <p>.

We have already covered the anchor tag <a>, which is one of the inline elements, in a previous section. There are many other commonly used inline elements. Inline elements can be divided into two general types;

  • Phrase elements that act to mark a word or phrase
  • Presentation elements that affect the display of the element

Although there are presentation markup elements, it is advisable to use CSS for presentation and rely on HTML specifically for semantic markup.

Phrase Elements

<em> and <strong>

Stress emphasis <em> and importance<strong> are used to indicate emphasis. Stress emphasis is recommended as a marker for text that would be stated with linguistic emphasis (such as rate of speech or intonation). Use <strong> for text with strong importance, where a speaker might not alter their voice.

<p>Beans are <em>really</em> good for you. They are great for your <strong>heart and soul</strong>.</p>

<cite>

Often it is necessary to cite the source of a statement or idea. The <cite> tag is defined specifically for this purpose.

<p>What's very important from my point of view is that there is one web … Anyone that tries to chop it into two will find that their piece looks very boring.<cite>Tim Berners-Lee</cite></p>

<dfn>

Sometimes we need to offer a definition for a term. The <dfn> tag is used for this purpose.