Wednesday 27 November 2013

The class Selector

class Selector

The class selector is used to specify a style for a group of elements.

Class selector is most often used on several elements.

This allows you to set a particular style for many HTML elements with the same class.

The class selector uses the HTML class attribute, and is defined with a "."

The name of Your class can be everything You want.

» EXAMPLE:


<html>
<body>
<style>
.par {
font-size: 30px;
color: blue;
text-align: center;
}
</style>

<h1 class="par">This is Heading with class "par".</h1>
<p id="par">This is paragraph also with class "par".</p>

</body>
</html>


» Result:

This is Heading with class "par".

This is paragraph also with class "par".

No comments:

Post a Comment