Background Colour class using Bootstrap
This Background is class='bg-primary' Hex : '#337ab7'
This Background is class='bg-success' Hex : '#c1e2b3'
This Background is class='bg-info' Hex : '#d9edf7'
This Background is class='bg-warning' Hex : '#f7ecb5'
This Background is class='bg-danger' Hex : '#f2dede'
Different size with colour. by using <h3>
This background is class='bg-danger'To add left padding by declaring style
You can add this by
Change to your own background colourAbove classes with five different colours are available by default. We can create our own class with our selected colour and add use them. Let us create own style property like this.
Output is here
This background is class='my_bg-class'
Where to keep this style codeYou can define your own style property page and inside this page you can keep your all common style code for your site.
Reading adding and removing bg classes from DivWe often use the same Div box to communicate different type of messages. Based on the requirement ( or condition ) we can change the class associated with the DIV or P tag.
Here d1 is the id of our alert message box.
Reading the present associated class
Removing one class and adding another.
Removing present class and adding a new class.
Here is a DEMO script to apply all classes to one DIV tag by using different buttons.