HTML Styles

Tags are used to define elements of a web page, such as headings, paragraphs and links. The browser then decides how these should look. However by adding the style attribute we can tell the bowser how to format the appearance of a specific element.

Syntax

To add styles to a tag we use the style keyword:

<element style=" ... ">

Inside the quotes we can list the styles (separated by a semicolon ; ) for example:

<p style="color: blue; font-family: Arial, sans-serif;">This paragraph will be blue, using the Arial font.</p>

Common Styles

Below are some commons styles that can be used to format the text:

color: Blue;

background-color: LightGray;

width: 500px;

height: 50px;

font-family: Arial, sans-serif;

font-size: 30px;

Challenge

Apply some styles attributes to format different elements of the page.