What is CSS in website designing?
586
12-Jul-2021
Why CSS plays an important role in Web Development? How it is use to HTML.
Updated on 12-Jul-2021
Ravi Vishwakarma
12-Jul-2021CSS
CSS stands for Cascading Style Sheet is a simple design language to simplify the process of making a web page. CSS handle the look and feel part of a web page. You can manage the color of button, spacing between paragraph, and background changes etc. it provide full control over the HTML page. CSS describe how HTML element are display on screen.
Advantages of CSS
1. CSS save time
2. Easy maintains
3. Platform independent
4. Page load faster
Syntax of CSS
selector {Property1: value1;
Property2: value2;
Property-n: value-n;
}
Example of CSS:
P {color: red;
text-align: center;
}
CSS selector
1. Id selector
2. Class selector
3. Tag name selector
4. Universal selector
Id selector
The id selector uses the id attribute of an HTML element to select a specific element.
To select an element with a specific id, write a hash (#) character, followed by the id of the element.
#id-name{Property: value;
}
Class selector
To select elements with a specific class, write a period (.) character, followed by the class name.
.class-name{Property: value;
}
Tag name selector
To select elements with a specific tag name, followed by the tag name.
tag-name{Property: value;
}
Universal selector
The universal selector (*) selects all HTML elements on the page by using the asterisk (*).
*{Property: value;
}
How to insert the CSS in HTML page
1. Inline CSS
2. Internal CSS
3. External CSS
Inline CSS
An inline CSS may be used to apply unique style for a single elements. This CSS write in style attribute, style CSS contain the any CSS property.
Internal CSS
The internal style sheet may be used if one single HTML has a unique style. This is used by style tag, this tag written in head tag.
External CSS
We can change the look and feel of an entire page by one page. This external page link by the link tag, in link tag use href attribute put stylesheet location in href attribute.
Example of CSS.
Output –