HTML CSS

CSS (Cascading Style Sheet) is used to describe how HTML elements are to be displayed on screen, paper, or in other media.

CSS minimizes time and work as it can control the layout of multiple web pages all at once.

Inline CSS

Inline style is applied to an individual tag. It modifies the attributes of a tag in the current occurrence of that tag.

Example

<!doctype html>  
<html>
 
    <head> 
        <title>Inline CSS</title> 
    </head>
  
    <body> 
        <h2 style="color: red;">PHPDocs</h2>
    </body>

</html>

Internal CSS

An internal style sheet is inserted in the head section of a web page. It only affects the web page in which it is inserted.

Example

<!doctype html>  
<html>
 
    <head> 
        <title>Inline CSS</title> 
        <style type="text/css">
            h2 {color: red;}
        </style>
    </head>
  
    <body> 
        <h2>PHPDocs</h2>
    </body>

</html>

External CSS

An external style sheet is defined in a separate file stored with .css extension. It is very useful when the style is applied too many pages.

To use an external style sheet, add a link to it in the section of the HTML page.

Example

 <!doctype html>  
<html>
 
   <head> 
      <title>Inline CSS</title> 
      <link rel="stylesheet" href="styles.css">
   </head>
  
   <body> 
      <h2>PHPDocs</h2>
  </body>