HTML Intro

HTML Intro Quiz

HTML Intro Exercise

HTML Basics

HTML Basic Quiz

HTML Basic Exercise

HTML Advance

HTML Advance Quiz

HTML Advance Exercise

HTML Tags List

HTML Global Attributes

HTML Attributes


class Attribute

class attribute



The class attribute specifies one or more class names for an element. It is mostly used for CSS styling but some developers use it in JavaScript.


Attribute Explanation:-


Value Description
classname Specifies one or more class names for an element. To specify multiple classes, separate the class names with a space.


Rules form naming classes are:-


  • Must begin with a letter i.e, A-Z or a-z
  • Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), and underscores ("_")




Its syntax is:- < element class="classname" >

Code Explanation

All Tutorials related to HTML Global Attributes

All Sections related to HTML