Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding more than one class

Tags:

Is it bad thing if I add more than one class for one object. Let's say:

<a href="#" class="paren" class="defaul">text</a>

Don't ask me why, I just need it.

Thanks.

like image 718
good_evening Avatar asked Oct 14 '10 17:10

good_evening


People also ask

How do you add more than one class to an element?

To specify multiple classes, separate the class names with a space, e.g. <span class="left important">. This allows you to combine several CSS classes for one HTML element.

Can you add 2 classes to a div?

Multiple ClassesHTML elements can belong to more than one class. To define multiple classes, separate the class names with a space, e.g. <div class="city main">. The element will be styled according to all the classes specified.

Can a button have multiple classes?

Yes, it is possible, but you can only declare the class attribute once per HTML element. Just separate the classes you want to apply by a space. If you declare the class attribute more than once, all definitions beyond the first will be ignored, so in your code .

How do you add more than one class in react?

Adding a single class name import React from 'react'; import './styles. css'; function App(){ return ( <div className="container"> <h1>Hello rock!! </h1> </div> ) } export default App; If you want to add multiple class names, you can add it to the className attribute by separating with spaces.


1 Answers

You can use multiple class names (a perfectly normal thing to do), but are only allowed one class attribute on your HTML element.

Do this instead:

<a href="#" class="paren defaul">text</a> 
like image 110
D'Arcy Rittich Avatar answered Sep 21 '22 05:09

D'Arcy Rittich