Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React using external css along with bootsrap framework classes

Tags:

html

css

reactjs

Sorry if the heading doesn't seem accurate.

I am doing changes in my webpack to use external css in my component/container.

I am also using Bootstrap where we have inbuilt classes.

Now, I want to use external classes along with bootstrap classes on an element.

For example consider this, we are importing our external css like this

import Classes from './signup.css'

Since we are also using boostrap hence my button element would be something like this

<button type="submit" className="btn mx-auto btn-primary" onClick={this.submitHandler}>Submit</button>

By making changes in webpack, we can use CSS like this

className={Classes.something} 

now I want to use this CSS along with my bootstrap classes and since an element can't have two class name, I am kind perplexed about how to proceed.

Can someone help me?


1 Answers

Have you tried doing something like this?

className={`class1 ${Classes.something}`}

This is also mentioned here in this stack question: Stack Overflow

like image 80
T. Evans Avatar answered Jun 05 '26 01:06

T. Evans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!