Style Classes

Style Classes

Posted on Updated on

In Style Classses method, you can create styles in the form of style classes in external or embedded style sheets. To apply a style defined in a style class to an HTML element, you can assign the class attribute of the HTML element to the name of the style class.

There are two types of classes

1)      Universal style class

2)      Element specific class

 

<html>

<head>

<title>Style classes</title>

<style>

body{ background-color:#f0f8ff}

th.color {background-color:#800000}

.green{background-color:#008000}

</style>

</head>

<body>

<table border=”1″>

<caption><h2>Student Details</h2></caption>

<th class=”color”>Name</th>

<th class=”color”>Date of Birth</th>

<th class=”color”>Address</th>

<tr>

<td class=”green”>sumit Saxena</td>

<td class=”green”>15/3/1983</td>

<td class=”green”>Mumbai</td>

</tr>

<tr>

<td class=”green”>Amitabh Kumar</td>

<td class=”green”>22/02/1984</td>

<td class=”green”>chennai</td>

</tr>

<tr>

<td class=”green”>Rohit Jindal</td>

<td class=”green”>5/7/1983</td>

<td class=”green”>Delhi</td>

</tr>

</table>

</body>

</html>

1

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: http://www.vissicomp.com