Cascading Style Sheets, fondly referred to as CSS, is a simply designed language intended to simplify the process of making web pages presentable. CSS allows you to apply styles to web pages. More importantly, CSS enables you to do this independently of the HTML that makes up each web page. It describes how a webpage should look: it prescribes colours, fonts, spacing, and much more. In short, you can make your website look however you want. CSS lets developers and designers define how it behaves, including how elements are positioned in the browser.
While HTML uses tags, CSS uses rulesets. CSS is easy to learn and understand, but it provides powerful control over the presentation of an HTML document.

Why CSS?
- CSS saves time: You can write CSS once and reuse the same sheet in multiple HTML pages.
- Easy Maintenance: To make a global change simply change the style, and all elements in all the webpages will be updated automatically.
- Search Engines: CSS is considered a clean coding technique, which means search engines won’t have to struggle to “read” its content.
- Superior styles to HTML: CSS has a much wider array of attributes than HTML, so you can give a far better look to your HTML page in comparison to HTML attributes.
- Offline Browsing: CSS can store web applications locally with the help of an offline cache. Using this we can view offline websites.
CSS versions release years: 
CSS Syntax:
CSS comprises style rules that are interpreted by the browser and then applied to the corresponding elements in your document. A style rule set consists of a selector and declaration block.
- Selector: A selector in CSS is used to target and select specific HTML elements to apply styles to.
- Declaration: A declaration in CSS is a combination of a property and its corresponding value.
Selector -- h1
Declaration -- {color:blue;font size:12px;}
- The selector points to the HTML element you want to style.
- The declaration block contains one or more declarations separated by semicolons.
- Each declaration includes a CSS property name and a value, separated by a colon.
For example :
CSS
selector {
property 1: value 1 ;
property 2: value 2 ;
}
|
CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.
Here is a more specific example: In the following example all p elements will be centre-aligned, with a blue text colour:
CSS
p {
color : blue ;
text-align : center ;
}
|

Let’s see how our page looks with & without CSS :
Before CSS: In this example, we have not added any CSS.
html
<!DOCTYPE html>
< html >
< head >
< title >Example</ title >
</ head >
< body >
< main >
< h1 >HTML Page</ h1 >
< p >This is a basic web page.</ p >
</ main >
</ body >
</ html >
|
Output:

Without CSS
After CSS: In this example, we added some CSS styling inside the HTML code only to show how CSS makes a dull HTML page look beautiful.
html
<!DOCTYPE html>
< html >
< head >
< title >Example</ title >
< style >
main {
width: 600px;
height: 200px;
padding: 10px;
background: beige;
}
h1 {
color: olivedrab;
border-bottom: 1px dotted darkgreen;
}
p {
font-family: sans-serif;
color: orange;
}
</ style >
</ head >
< body >
< main >
< h1 >My first Page</ h1 >
< p >This is a basic web page.</ p >
</ main >
</ body >
</ html >
|
Output:

With CSS