Paragraphs
Syntax
A paragraph element is created using an opening and closing p
tag and the paragraph text as content. Paragraph elements cannot be nested.
1 2 3 | <p>Hello there. This is an example of a paragraph element in HTML.</p> <p>Here is another paragraph. Note that it is rendered beginning on a new line.</p> |
A paragraph element is usually not displayed inline. In other words, each paragraph will begin on a new line (unless specified otherwise in the CSS).
Output:
Hello there. This is an example of a paragraph element in HTML.
Here is another paragraph. Note that it is rendered beginning on a new line.
Paragraphs and emphasize tags
Text in paragraphs can be modified to add emphasis or provide a visual cue to the user as what the text is. Here are some example modifiers:
1 2 3 4 5 6 7 8 | <em>Emphasized text,</em> <strong>Strong text,</strong> <code>Computer code text, </code> <cite>In-line citation,</cite><br/> <dfn>Definition term,</dfn> <samp>Sample computer code text,</samp> <kbd>Keyboard text,</kbd> <var>Variable,</var> |
Of course each of these modifiers may be styled using CSS. Thus the output you are seeing below is by no means the canonical style of each modifier; it is simply how we chose to style them.
That being said, text emphasized with em
is usually italicized, strong
text is usually bold and computer code is often displayed in a different, monospaced, font.
Output:
Computer code text,
In-line citation,Definition term, Sample computer code text, Keyboard text, Variable,