How to use CSS in HTML to style your web page?

By | November 22, 2015

This post is helpful for newbies who want to start building simple HTML pages and wish to decorate the page with different styles.

Let us understand what is CSS?
CSS is an acronym for Cascading Style Sheet which describes how your text or HTML tags written in a markup language should be displayed.

To use CSS in HTML pages you need to link your style sheet elements with an HTML page. This can be done in 3 different ways.

  1. Inline styles: Inline styles are directly written within the tag on the document. You can see the inline styles used in this document.
  2. Embedded styles: Embedded styles are embedded in the head of the document.
  3. External styles: As the name explains the external styles are linked from an external CSS file. You can see the external styles used in this document.

 

 

 

 

Just save both files in a common directory with given names. Now open your HTMLPage.html. If you cannot open it, you can just drag it into any web browser. You should be able to see the page as given shown in the below picture.

Output:

 




Suggested articles for you:

Did it help? Comment here..

This site uses Akismet to reduce spam. Learn how your comment data is processed.