class Attribute
class attribute defines one or more names for an element. class attribute can be used on any HTML element. It is a global attribute.
Example:
<div class="country">
<h2>USA
</h2>
<p>USA is a beautiful country.
</p>
</div>
<div class="country">
<h2>Australia
</h2>
<p>Australia is a beautiful country.
</p>
</div>
<div class="country">
<h2>China
</h2>
<p>China is a beautiful country.
</p>
</div>
Run Example
Browser Support
Attribute |
Firefox |
Chrome |
IE |
Opera |
Safari |
class |
yes |
yes |
yes |
yes |
yes |