Home >Web Front-end >CSS Tutorial >How Do I Assign Multiple Classes to an HTML Element?

How Do I Assign Multiple Classes to an HTML Element?

Susan Sarandon
Susan SarandonOriginal
2024-12-17 10:16:25824browse

How Do I Assign Multiple Classes to an HTML Element?

Assigning Multiple Classes to an HTML Container

Can you assign multiple classes to a single HTML container? It may seem like you could separate the class names with a comma, as in:

<article class="column, wrapper">

However, this will not work. To assign multiple classes to an element, simply remove the comma and use a space instead:

<article class="column wrapper">

This will correctly apply both the "column" and "wrapper" classes to the article element.

The above is the detailed content of How Do I Assign Multiple Classes to an HTML Element?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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