HTML - Class Attribute

HTML Class Attribute

The class attribute is used as class identifier one or more elements. Different HTML elements can have the same class name.

How To Style

This is how to point a particular styling to a class.

  • Inside the <style> tag in your <head> tag. First write the period or dot character (.).
  • Followed by the name (value) of the attribute .underline
  • Add opening and closing curly braces { } and define your styling inside it. .underline { text-decoration: underline; }.

Example

Case Sensitivity

Class values (names) are case sensitive. underline is NOT the same thing as Underline.

note
NOTE:

Class values (names) must contain at least one character
Values (names) must NOT contain white spaces.

ADVERTISEMENTS

LEARNING IS A CONTINOUS PROCESS - PRACTICE MAKES PERFECT