Here i explain, what is CSS and how to use ?
What is CSS ?
CSS stands for Cascading Style Sheet. CSS is used to provide layout to html pages easy and efficiently.We can apply same CSS style to individual item or single page or multiple pages.
External CSS stylesheet can be apply to multiple pages.This is very helpful ,when you want same style for your website.
how to apply CSS?
we have syntax to apply CSS.
Syntax:element where have to apply{property:value;}
example: img { width: 200px; height: 200px;}
For apply CSS to any HTML element, we have to define CSS selector for particular HTML element.For these we have these selector.
1. Element selector
This selector apply CSS to that HTML element that is define by Element.
Example: If we want to apply text color to paragraph using CSS.Follow these instructios:-
<style>
p{color:red;}
</style>
2. Id selector
This selector apply CSS to HTML element which is define with id attribute.
Example:If we want to apply text color to paragraph using CSS which is define by Id. Follow these instructios:-
<style>
#par{color:red;}
</style>
3. Class selector
This selector apply CSS to HTML element which is define with class attribute.
Example:If we want to apply text color to paragraph using CSS which is define by class. Follow these instructios:-
<style>
.par{color:red;}
</style>
If you want to apply same CSS for different HTML elements,you can do this by following:-
Example:-
<style>
h1,p{color:red;}
</style>
No comments:
Post a Comment
Leave a Reply!