Using multiple CSS classes for one element in HTML

WBOY
Release: 2023-09-09 08:45:03
forward
714 people have browsed it

Using multiple CSS classes for one element in HTML

To create CSS faster, we can assign multiple classes to a single HTML element and style each class separately. This approach allows us to manage redundancy in style application. We can apply common styles to many classes and category-specific styles to specific categories.

grammar


Copy after login

Example

In the following example, we use the style of class "Varma" to apply to two paragraphs, and the second paragraph has the style of secondclass varma1 applied.



   

   

Hello Everyone.

Welcome to Turorialspoint.

Copy after login

The results will be generated after executing the above script. It is a combination of the text "Welcome to tutorialspoint" with two CSS styles and the text "Hello everyone" with a single CSS style.

Example: Using javascript

In the following example we are adding two style to an single text by declaring the .bg-blue style and .text-white style.



   

   
Welcome To Tutorialspoint
Copy after login

When executed, the script generates a text output with two CSS styles applied: "Welcome to Tutorial Point".

The above is the detailed content of Using multiple CSS classes for one element in HTML. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!