Edit Article How to Define a CSS Class Style



Classes are a nice feature in HTML that allows you to assign a certain name to an element. They can be styled using CSS. If you don't know how to use those features, this article will help you.

Steps

  1. 1
    Make your HTML document.
  2. 2
    Create the basic HTML skeleton. As a reminder, it's an opening HTML tag, an opening head tag, a closing head tag, an opening body tag, a closing body tag, and a closing html tag.
  3. 3
    Create a HTML element. It can be a paragraph, heading, or whatever you want.
  4. 4
    Give the HTML element a class. Do this by inserting "class="classname" inside the opening tag for your element.
  5. 5
    Put a "style" tag between the head tags. You'll put your CSS here.
  6. 6
    Call your class. This is done by putting ".classname { }" in the CSS document.
  7. 7
    Put the styles your want between the curly brackets.
  8. 8
    Enjoy your styled HTML element!