Forum : difference between p.figure and .figure
Brief description  about Online courses   join in Online courses
View Rajesh Chandra Benjwal 's Profile

difference between p.figure and .figure

what is the difference between making a figure class and applying it to a <p> tag like <p class="figure> or making a class p.figure{}, means a <p> tag where the figure class is applied.

I can understand the difference like p.figure span{} here is clear only apply instructions on those <span> tag which are descendant of that <p> tag in which figure class has been applied. So it will not affect any other <span> tag which is outside the rule. But I didn't understand the use of p.figure{} and also p .figure and practical use of both.

Please clear the doubt.
Asked by Rajesh Chandra Benjwal | Mar 10, 2011 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi

In your page if you have around 20 <p> take example, in that <p> some of that you want add red color through java script, that time you can make one extra class, ex: .red

In HTML file <p class "red"> to check </p>

In JS you will write all <p> which have class red, you need red color, so automatically that will apply

Regards
Mar 11, 2011