In previous post, we learnt how to customize Bootstrap while downloading fromt the official website. In this post, we shall learn how to customize / override default Bootstrap CSS classes behavior.
Let's take an example of a Label class in Bootstrap.
Write following code in the web page that is using Bootstrap .css file
<label class="label-default">This is default label.</label>
The output will be something like
Now, add following CSS style to the page after the Bootstrap.css file reference.
<style>
.label-default{
background-color:#b6ff00;
}
</style>
<h2>Customize Bootstrap</h2>
<label class="label-default">This is default label.</label>
The output will be like this
This happens because the default property of Boostrap.css file for .label-default
class is overridden by the above .css class .label-default
declared inside the <style>.
<head>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/custom.css" rel="stylesheet"/>
</head>
Note: It is not advisable to change the .css classes declared in the bootstrap.css, this helps to rollback the changes easily and focus on custom.css file for any change rather than going through original bootstrap.css.
Views: 19643 | Post Order: 7