How to assign multiple classes to an HTML container?

HtmlClass

Html Problem Overview


Is it possible to assign multiple classes to a single HTML container?

Something like:

<article class="column, wrapper"> 

Html Solutions


Solution 1 - Html

Just remove the comma like this:

<article class="column wrapper"> 

Solution 2 - Html

From the standard

> 7.5.2 Element identifiers: the id and class attributes > > Attribute definitions > > id = name [CS]
> This attribute assigns a name to an element. This name > must be unique in a document. > > class = cdata-list [CS]
> This attribute > assigns a class name or set of class names to an element. Any number > of elements may be assigned the same class name or names. Multiple > class names must be separated by white space characters.

Yes, just put a space between them.

<article class="column wrapper">

Of course, there are many things you can do with CSS inheritance. Here is an article for further reading.

Solution 3 - Html

To assign multiple classes to an html element, include both class names within the quotations of the class attribute and have them separated by a space:

<article class="column wrapper"> 

In the above example, column and wrapper are two separate css classes, and both of their properties will be applied to the article element.

Solution 4 - Html

you need to put a dot between the class like

class="column.wrapper">

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionARGOView Question on Stackoverflow
Solution 1 - HtmlAurelio De RosaView Answer on Stackoverflow
Solution 2 - HtmlJonathan HensonView Answer on Stackoverflow
Solution 3 - HtmlWebengView Answer on Stackoverflow
Solution 4 - Htmlamit kumarView Answer on Stackoverflow