As I delve into programming with Bootstrap, I encountered an issue while attempting to change the background color of my body
. Even though I used the following CSS code:
body {
background-color: #eba;
width: 100%;
height: 100%;
}
The color change didn't take effect. This led me to wonder how exactly can I style elements when working with Bootstrap? Upon inspecting the developer's tools, I noticed that the property background-color: #eba;
was ignored and overridden by Bootstrap's default body color
. Why does this happen? Shouldn't my custom styling take precedence over Bootstrap's defaults?
Relevant HTML
<body>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 1</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 2</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 3</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 4</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
</div>
</div>
</body>
</html>
Relevant CSS
body {
background-color: #eba;
}