Hi friends... Welcome back!
Today will see CSS Id and Class. and how to use Id & Class.
Ok Lets come!
CSS Id:
The Id selector is used to specify a style for a single,unique element.
The Id selector is defined in "#"
Syntax:
CSS Class:
The Class selector is used to specify a style for a group of elements.
The Class selector is most often used several elements.
The Class selector defined ".".
Syntax:
Example:
<html>
<title>CSS Example</title>
<style type="text/css">
#idselector
{
width:400px;
height:200px;
background-color:#FFFF99;
border:1px solid #FF0033;
}
.classselector
{
width:400px;
height:200px;
background-color:#00CC66;
border:1px solid #CC0033;
}
</style>
</head>
<body>
<div id="idselector"><h1>Hello</h1></div>
<br>
<div class="classselector"><p>Google
www.google.co.in/Indian version of this popular search engine. Search the whole web or only webpages from India. Interfaces offered in English, Hindi, Bengali, Telugu, Marathi .</p>
</div>
</body>
</html>
Outout is:
Note: You want add Id and Class is same html elements or division like following example.
Example
<div id="idselector" class="classselector">......</div>
Next section i will explain full CSS Property and how to use in your HTML Page!
Thank you Guyz!
Today will see CSS Id and Class. and how to use Id & Class.
Ok Lets come!
CSS Id:
The Id selector is used to specify a style for a single,unique element.
The Id selector is defined in "#"
Syntax:
CSS Class:
The Class selector is used to specify a style for a group of elements.
The Class selector is most often used several elements.
The Class selector defined ".".
Syntax:
<html>
<title>CSS Example</title>
<style type="text/css">
#idselector
{
width:400px;
height:200px;
background-color:#FFFF99;
border:1px solid #FF0033;
}
.classselector
{
width:400px;
height:200px;
background-color:#00CC66;
border:1px solid #CC0033;
}
</style>
</head>
<body>
<div id="idselector"><h1>Hello</h1></div>
<br>
<div class="classselector"><p>Google
www.google.co.in/Indian version of this popular search engine. Search the whole web or only webpages from India. Interfaces offered in English, Hindi, Bengali, Telugu, Marathi .</p>
</div>
</body>
</html>
Outout is:
Note: You want add Id and Class is same html elements or division like following example.
Example
<div id="idselector" class="classselector">......</div>
Next section i will explain full CSS Property and how to use in your HTML Page!
Thank you Guyz!
No comments:
Post a Comment