This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class is a CSS Class

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


Eric
 
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
A teeny tiny vulgar attempt to get you to buy our stuff
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic