CSS HTML Javascript jQuery Ajax PHP Example Java MORE

How to add CSS

There is three-way to add CSS in an HTML document.

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

Inline CSS

The CSS has written in a single line to apply CSS is called Inline CSS.It is done by using the style attribute.

Example:

Internal CSS

An Internal CSS style is only applied for the same page. The CSS rule is written inside an <style> element and placed between the <head> tag.

Example:

External CSS

External CSS is used when we using multiple HTML pages with similar CSS files. This can be done by having an external CSS file. The external CSS file must save with the extension with .css. It is a good way to apply CSS for your HTML page. The main advantages of external CSS are, you can change all the page style from a single CSS file.

Example: