HTML CSS


HTML HTML CSS External Css Example

What is CSS?

CSS stands for Cascading Style Sheets. It defines how Html elements are displayed in web browser.(color and style etc). Browser format web pages according to information in CSS.

Example:-

<p style="background-color:green;color:white;font-size:20px;">This is paragraph about CSS. CSS stands for Cascading Style Sheet.</p>

Output:-

This is paragraph about CSS. CSS stands for Cascading Style Sheet.

Types Of CSS

  1. Inline CSS
  2. Internal CSS
  3. External CSS

Inline CSS:-

Inline CSS is applied to Html elements using style attribute.

Example:-

<p style="background-color:green;color:white;">This is paragraph with inline CSS.</p>

Output:-

This is paragraph with inline CSS.

Internal CSS:-

It is defined in <head> tag of Html document.(<style> tag within <head> tag.) It define styles for single html element. This element having same styles, where this element is used.

Example:-

<html><head><style> h6{color:white; background-color:red;} </style></head><body> <h6>Internal CSS</h6> </body> </html>

Output:-

Internal CSS

External CSS:-

External CSS define styles for one or more pages. This is written in external text file with extension css and linked with Html pages. Add link in <head> section.

External CSS Syntax

<html> <head> <link rel="stylesheet" href="File path"> </head> <body> </body> </html>
HTML External Css Example Chapter Next »