What is the purpose of class selector?



Purpose of Class Selector-
Style sheets support classes or sets of styles changes for document. A Class can be defined to change the style in a specific way for any element it is applied to, and classes can be used to identify logical set of styles changes that might be different for different HTML elements. The style changes can be applied directly to each HTML element or applied to part of a document with the <span> </span> tags. If any element is made a member of a class by inserting class=classname into its opening tab, it conforms to that specification.
Example-
<html>
<head>
<title>
working with class
</title>
<style type="text/css">
P{font-size:12pt;font-weight:bold;text-align:justify;margin-left:10%; margin-right:10%}
.question{color:black; font-style:italic}
.answer {color=:#2328e}
</style></head>
<body bgcolor="yellow">
<P class="question"> How to create style sheet to alter an HTML element?<P>
<P class="answer"> The style assignment process can be accomplished with the &lt;style&gt...&lt;/style&gt; tags. The syntax for making the assignment is simple. Between &lt;style&gt...&lt;/style&gt; , HTML tags to which styles aare to be assigned are to be listed and each tag with a pair of curly brackets in which specific style attributes are to be specified. This &lt;style&gt tag hould be whithin &lt;head&gt...&lt;/head&gt; element.</P>
<P class="question"> What are the attributes that can be specified? </P>
<P class="answer"> The attributes that can be specified are, Font attributes, Color and Background attributes, Text attributes, Border attributes, Margin attributes and List attributes.</P>
</body>
<html>

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart