attribute is different to the
<title></title> tag (which goes in the page
head and sets the title of your page).
The title attribute provides a bit of
extra information for a visible element, like a link, image or button.
In most browsers, it causes a tooltip to appear when the
pointer hovers over the element.
title="Don't click this, it doesn't do anything." value=" Useless "
Almost any tag that you put in the
HTML body can have one or more classnames. The example div above has
two classnames: "comment" and "code".
At the highest level, a tag's classes
provide additional description about what kind of element the tag is.
For example, the example above is described as a "comment" container
and also as "code" container.
These definitions don't really mean
much on their own, but it's good practice to make sure they make sense
(i.e. semantically useful). (For example, my code
snippets get the "code" classname, instead of being called
class="greybox" or class="typewriterstyle")
What you can do with Class
You mainly use an element's
classname(s) to assign styles through Cascading
Style Sheets, but it's also possible to read them and do
stuff in DHTML.
Example of applying styles in CSS
using elements' class. The classname is prefixed with a dot/period to
specify that it applies to elements with class="comment".