What is CSS?
- CSS is a language that we use to style an HTML document.
- It describes how HTML elements will be displayed.
- CSS stands for Cascading Style Sheets.
- It control the layout of multiple web pages all at once.
- It uses write once and use multiple times approach.
- CSS is used to make beautiful and responsive websites.
Why CSS?
- It saves a lot of time and work.
- Using CSS in HTML document we can write CSS once and use many times.
- We can easily change the style of multiple elements by changing the style in the stylesheet once.
- It is used to style the data or content which is displayed on the web browser.
Syntax of CSS
p { color: red; }
In the given syntax p is selector, color is the property and red is the value. (Watch YouTube video for better understanding)
Ways to Add CSS in HTML?
- Inline CSS: It is used to add CSS directly in HTML elements using style attribute.
- Internal CSS: It is used to add CSS using <style> tags inside the head tag.
- External CSS: It is used to add a .css file using link tag. And external CSS contains a separate CSS file.