assigning multiple css classes to an object

It is also possible to assign multiple css classes to a single html object.  In that case, the names of the css classes will be written in “class” property of html object with spaces.

In the following example, the second paragraph tag P is assigned with two classes, the myclass2 is changing the color of the font, whereas the class myclass3 is increasing size of font.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.myclass1
{
color:#900;
}
.myclass2
{
color:#63C;
}
.myclass3
{
font-size:16px;
}
</style>
</head>
<body>

<p class="myclass1">
This is web engineering course, and we have started cascaded style sheets
</p>
<p class="myclass2 myclass3">
This is second P tag. This is web engineering course, and we have started cascaded style sheets
</p>
</body>
</html>

 

 

Add a Comment

Your email address will not be published. Required fields are marked *