CSS: Fonts

The CSS color property defines the text color to be used for the HTML element.
The CSS font-family property defines the font to be used for the HTML element.
The CSS font-size property defines the text size to be used for the HTML element.

HTML file: Displayed by browser:
<!DOCTYPE html>
  <html>
    <head>
      <style>
h1{
    color:blue;
    font-family:verdana;
    font-size:300%;
}
h3{
    color:purple;
    font-family:arial;
    font-size:175%;}
p{color:red;font-family:courier;font-size:22px;}
      </style>
    </head>
    <body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
    </body>
  </html>

This is a heading

This is a paragraph.

It doesn't matter where the curly brackets are placed or how many lines the styles take up. Remember that browsers ignore extra spaces and line breaks. The setup for "h1" styling is aesthetic and easier for adding, modifying or deleting style properties and values.

Back buttonTable of ContentsNext button