Intro to HTML: Font Styling

Quick Copy Boxes

There are HTML style attributes and tags that can change the formating of the text contained in the element.

At the bottom of this page there is a code editor pre-loaded with the lesson's code.

Fonts

You can change the font of the content inide an element. Some possible fonts:
✶ Courier New
✶ Helvetica: Aligns element to the right.
✶ Arial: Centers the element.
✶ Lucida: Each line will be equal length, like a newspaper.
for more common fonts visit: Web Safe Fonts

Example: font-family


<p style="font-family:courier;">This is a paragraph.</p>
            

style The paragraph's font is set to courier.
Content This content's font will be courier


Font Color

You can change the font color


Example: font-color

   
   <p style="color:blue;">This is a paragraph.</p>
               

style The text in this paragraph will be colored blue.
Content This is the content that will be blue.


Font Size

You can also change the size of text.

Example: font-size

      
<span style="font-size:200%;">This is bigger text.</span>
                  

style The text in this span will be twice the size as the default font-size.
Content This is the content that will be bigger.


Strong Tags (bold)

You can use strong tags to make text bold.

Example: Strong Tags


<strong>This is bold text.</strong>
            

<strong> Strong Tags
Content This content will be bold.


Italic Tags

You can use <i> tags to make text italic.

Example: Italic tags

   
   <i>This is italic text.</i>
               

<i> Italic Tags
Content This content will be italic.

Next, play around with the code below. Change the appearence of the text by changing attributes and tags.