CreateaFreeWebsite

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.

The Result

This code would produce the results shown here, when using the span tag to change the size of the text to 28px.

The HTML

<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;
font-weight: 600
}

The Result

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

The HTML

<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

Tags that can be used to change text within a paragraph are:

Rotating Text

You can do some amazing things with CSS these days. These are just two examples of ways to manipulate text.

Writing Mode Property

How toRotateText

The HTML

  
<h3>How to<span class="rotate"> Rotate</span>Text</h3>
  

The CSS

  
span.rotate {
color: #ff0000;
font-weight:600;
writing-mode: vertical-lr; 
text-orientation: upright; 
letter-spacing: -.5rem; 
line-height:1.5rem}
  
  

 

Using Transform Property

Rotate

The HTML

 <div class="rotate">Rotate</div>
  

The CSS

  
div.rotate {
display: inline-block;
transform: rotate(-45deg);
color: #ff0000;
font-weight: 600;
padding: 1rem 13rem
  
  

 

Top