How to define multiple style rules for a single element in CSS?


You may need to define multiple style rules for a single element. You can define these rules to combine multiple properties and corresponding values into a single block as defined in the following example: 

h1 {
   color: #36C; font-weight: normal;
   letter-spacing: .4em;
   margin-bottom: 1em;
   text-transform: lowercase;
}

Here all the property and value pairs are separated by a semicolon (;). You can keep them in a single line or multiple lines. For better readability, we keep them on separate lines.

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 30-Jan-2020

738 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements