knowledgediarybd.com

Your Virtual Knowledge Campus

CSS ID AND CLASS

Untitledcss-id and css Class are two important part of cascading style sheets. css id  and class are used in  web page designing to do more styling and attractive webpage.

Dear learner in this css tutorial you can know about css-id and class,how to declare css id and class & how to use these.

CSS ID:

Normally css ID is defined by a dollar sign($) before a sector name.

Syntax of CSS ID:

#[sector name]

{

selector’s attribute or declaration here

}

For Example:

#fotter                       /*> selector which is external css*/

{

width:100%;
height:35px;
background-color:#000000;
color:#FFFFFF;
text-align:center;
font-family:”Times New Roman”, Times, serif;
font-size:16px;

}

An example of applying above ID #fotter:

<html>

<head>

<title>CSS ID and Class</title>

</head>

<body>

<div id=”fotter“> All Right Reserved By Md.Humayun Kabir</div>

</body>
</html>

CSS Class:

css class is defined by a dot(.)sign,before a selector name.

Syntax of  declaring CSS class:

.[class Name]

{

Selector property or declarations here;

}

For example:

 .section_w500 {
clear: both;
margin-bottom: 30px;
}

Example of applying above code:

<body>

<div class=”section_w500“> /* section_500 called here.*/

<h1> This an example of css class</h1>

</div>

</body>

Multiple class example:

a.example

{color:red;

font-size:12px;

}

b.example

{ font-family:”Times New Roman”;

text-align:center;

}

HTML Code Example By Using multiple class:

This  <a class=”example” > is an example</a> <b class=”example”>

of css multiple class selector </b>.

Related Post or you may fell interest:

knowledgediarybd.com © 2017
shares