File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the use of class attribute associated with a HTML element.

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<a href="backuplink.html" class="doSomething">Click!</a>

why class is being used here instead of directly using onclick ??


Thanks in advance.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class is a CSS Class

Read about it here:http://www.w3schools.com/css/css_syntax.asp


Eric
 
Brian Legg
Ranch Hand
Posts: 488
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would use "class" to refer back a predefined CSS style. You can leave it out and the default or global styles will take place or you can specify a class and have those styles applied. This is great when you have multiple styles for one type of element and you want them to have different styles from each other.

Consider this CSS style:



Now, let's say you have a hyperlink on your website. Any hyperlinks you want to be red you would do this:



And any hyperlink you wanted blue you would do this:



You can do this with just about any element, not just anchor tags.

HTH GL
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic