user10154568
user10154568

Reputation:

Automatic margins when using css

If i used CSS my div automatically margins left and right if i use inline style its works perfect,i don't understand whats going when i use CSS i'm using React.js

I'm trying to style with CSS,its gives auto margin to left and right

<div className="container">
            <h1>hello</h1>
</div>

//CSS code

.container background-color: lightblue; }

//i'm using inline style its works perfect

``
<div style={{backgroundColor: 'blue'}}>
            <h1>hello</h1>          
</div>
``

Upvotes: 0

Views: 60

Answers (2)

bilu sau
bilu sau

Reputation: 61

Please note, container is a bootstrap class, so it adds style from bootstrap library as and try using any other classes name it will be worked excellent.

Upvotes: 0

Tayyab Razzaq
Tayyab Razzaq

Reputation: 461

I guess you have included bootstrap in your project and container is a bootstrap class, so it adds style from bootstrap library as well Try using any other class name it will just work fine.

Upvotes: 1

Related Questions