elibraryportal Logo

How to Use CSS

There are three ways to use CSS in HTML documents that is.

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

1) Internal CSS

Internal CSS are defined within the <style> tag, inside the <head> section of an HTML page:



Test it Now

2) External CSS

One external file is used for multiple html pages.

Each HTML page must include a external style sheet file inside the head section.

You can write all the CSS code in a css file. Its extension must be .css for example mystyle.css.



File Name:- Hello.html

Note:- First Open Notepad write only HTML Code and save Hello.html

File Name:- mystyle.css

Note:- Then Open again Notepad write the Only CSS code and save mystyle.css then link on HTML page in head section.

Test it Now

3) Inline CSS

style tag is used to a single elements.


Test it Now
Next TopicCSS Comments