CreateaFreeWebsite

 with HTML and CSS

The Paragraph Tag

The paragraph tag <p></p> is used to place paragraphs in your pages. Does require a closing tag. </p>

Setting Paragraph Attributes

Attributes for paragraphs can be set using embedded, linked or inline style sheets.

This style sheet would set our paragraph text to 16 pixel Arial, set alignment of text to the left and indent the paragraph 1 em(1rem).

You can also set the color of text, weight of text, style of text, line spacing, width and add top, right, bottom and left padding.

You can add other interesting CSS features like borders , round corners and box-shadow.


p { 
font-family: Arial , sans-serif;
font-size : 1rem;
font-weight : normal;
text-align :left;
text-indent : 1em
}

Just for Fun

Round and Raised

This paragraph uses all 3: border, border-radius and box-shadow..

CSS:


text-align: left;
text-indent: 1rem;
width: 33dvw;
margin: 0 auto; /*Center in container*/
padding: 2dvw; 
border: solid #efefef 1px; 
border-radius: 1.25rem; 
box-shadow: 5px 5px 10px #0e0e0e

Same with inset box shadow

This paragraph uses all 3: border, border-radius and inset box-shadow.

CSS:


text-align: left;
text-indent: 1rem;
width: 33dvw;
margin: 0 auto; /*Center in container*/
padding : 2dvw; 
border: solid #efefef 1px; 
border-radius: 1.25rem; 
box-shadow: 5px 5px 10px #0e0e0e inset

SEE ALSO: Round corners and Box shadow

Using Inline Style Sheets

The appearance of text within a paragraph can be changed using inline style sheets.

We discourage the use of the inline style sheet. Its overuse can create havoc when it comes time to edit multiple web pages. Instead use the span tag with the class attribute for any inline style variants.

Span Tag

The span tag <span></span> is a useful tool for changing font appearance within a paragraph. The span tag should only be used as an inline tag.

This code would produce the results shown here, when using the span tag to change the size of the text to 28px.
<p>This code would produce <span class="larger">the results shown here</span>, when using the span tag to change the size of the text to 28px.</p>

The CSS: span.larger {font-size: 28px}

It could also be used to change the color of the text.

<p>It could also be used to change the <span class="red">color</span> of the text.</p>

The CSS: span.red {color: red}

Other inline tags that can be used to change text within a paragraph are:

 

Top