Home > Software design >  How to add css style beside the bootstrap styles
How to add css style beside the bootstrap styles

Time:12-28

I am new in css and html I added some bootstrap styles to my elements in HTML as you know when you add bootstrap style to an element, the class would be taken . so I can not add my own css style to it . is there anyway to fix this ?? is adding the ID to element the only way ? Thanks lot .

CodePudding user response:

Some of the bootstrap elements have their own customization, such as changing from bg-light to bg-dark. But if you need to change something you can simply assign a new class and make the necessary changes
Example:

<button type="button" >Primary</button>
.mystyle
{
    background-color: white;
}

If your styling doesn't apply just add !important to take priority over boostrap:

.mystyle
{
    background-color: white !important;
}

CodePudding user response:

You can use !important rule to give highest priority to the property you described.

Example:

#myid {
  background-color: blue;
}

.myclass {
  background-color: gray;
}

p {
  background-color: red !important;
}
  • Related