Stylesheets: Which Type to Use and When Should One Use It?

In coding webpages with HTML, you will learn how to styles different variations like headings, page layout, and some special page sections. This process of styling in HTML is called webpage formatting. It involves using a stylesheet, popularly known as CSS (Cascading Style Sheets).

Types of Stylesheets

There are stylesheet types available for use when formatting a webpage or a blog theme. They include internal, external, and inline styling.

1. Internal Stylesheet

This style is added to the head section of the page. The styles applied in an internal stylesheet are applied only to the page they are coded into.

The internal stylesheet will usually come as <style type=”text/css”> Style Types </style>.

2. External Stylesheet

This uses an external file with your styles added to it, which formats the entire webpage. It’s also the best for universal formatting as it applies any styles you want or change, and everything follows immediately.

The file link is added to the head section when coding your web page. It usually comes as <link rel=”stylesheet” type=”text/css” href=”styles/stylesht.css”>. With XHTML, it is <link rel=”stylesheet” type=”text/css” href=”styles/stylesht.css” />.

Href refers to the folder location of the external stylesheet.

3. Inline Style

This is the most common stylesheet that targets a specific HTML element. However, it can be tedious as it must be applied to every element that you want styled. Thus, it is seldom used when you want to highlight a specific element on your webpage. However, this style is best included in the stylesheet unless necessary. Also, it is recommended not to use excessive inline style.

Leave a Reply

Your email address will not be published. Required fields are marked *