The easiest way to customize a theme is to override its styles. It is preferable that you use Google Chrome because of its outstanding Developer Tools, but you are free to use any tool that you feel comfortable with. However, the examples in this book use Chrome developer tools, so it may be easier to follow if you use this as well. Perform the following steps to customize your theme:
To override styles, you should create a new style sheet named custom.css
and include it directly after bootstrap.min.css
in index.html
; this is shown in the following code snippet:
<head> <title>A simple blog · </title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/custom.css" rel="stylesheet"> </head>
jumbotron
.Sometimes, you may have to scroll down quite a bit in order to find the style that you want to override.
.container .jumbotron
selector in bootstrap.min.css
. To remove its rounded corners, you need to define a new style using the same selector in custom.css
:.container .jumbotron { border-radius: 0; }
Note that the labels are defined with a .label
selector, so you need to define the following style in custom.css
to remove the rounded corners:
.label { border-radius: 0; }
#bada55
, which is a lime green color. Use the same technique to find the selector for each element.Label colors are defined with a .label-primary
selector, so add the following code to custom.css
:
.label-primary { background-color: #bada55; }
custom.css
:.label-primary[href]:hover, .label-primary[href]:focus { background-color: #bada55; }
custom.css
:a, a:active, a:focus, a:hover, a:visited { color: #bada55; }
This is just a fraction of what you can do when it comes to customization of Bootstrap themes through overriding styles in CSS. Feel free to use your imagination to customize the example further. Next, you will learn some best practices to bear in mind when customizing Bootstrap themes through CSS.
3.144.48.204