Background Color not changing bug

131 views Asked by At

I cannot figure out where the bug is in this code. I'm trying to change the background color to anything using the following css:

body {
background-color: black;
    padding: 0px;
    margin:0px; 
    height: 1500px;
}

But its not changing anything except shifting the navbar down a few rows for some reason. Why is this happening and why can't I change the background color?

index.html

<!doctype html>
<html>
<head> 
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href=""> <!--tab image-->
<title> Bear Patrol | Home </title>
<link rel="stylesheet" type="text/css" href="main.css">
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <a id="logo" href="index.html">BEAR PATROL</a>
    <ul class="nav navbar-nav navbar-right">
        <li><a href="index.html">HOME</a></li>       
        <li><a href="about.html">ABOUT US</a></li>
        <li><a href="contact.html">CONTACT</a></li>
    </ul>
</div><!-- /.navbar-collapse -->
<div>
    <div class="col-xs-8 col-xs-offset-2 col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 center hero-unit">
        <h1 id="name">BEAR PATROL</h1>
        <img id="mainPic" src="bp.jpg">
        <div id="bio">
            <h4>Late Night Escorts Anywhere On Campus</h4>
            <h4> Headquarters Located in Whispers </h4>
            <h4>Available 8 PM to 2 AM Every Day</h4>
        </div>
    </div>
</div>

<div id="contact" class="col-xs-8 col-xs-offset-2 col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 center hero-unit">
        <a href="contact.html"><h1> REQUEST AN ESCORT!</h1></a>

    </div>
</div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- js -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

main.css

body {
    padding: 0px;
    margin:0px; 
    height: 1500px;
    background-color: black;
}

#img {
    text-align: center;
    height: 300px;
    width: 230px;
}

#mainPic {
    text-align: center;
    height: 300px;
    width: 500px;
    margin: 50px;
}

form {
    margin-left: 176px;
    margin-top: 30px;
}

#title {
    padding-top: 105px;
    text-align: center;
    margin-top: 0px;
    color: white;
    font-size: 60px;
    font-family: helvetica;
}

#logo {
    font-size: 20px;
    font-style: bold;
    margin-top: 28px;
    margin-left: 20px;
    display: inline-block;
    border-style: solid;
    border-width: 5px;
    padding: 10px;
}

#info {
    text-align: center;
    padding-top: 20px;
    color: white;
    font-size: 68px;
    font-family: helvetica; 
}

.hero-input {
    padding: 5px;
    margin: 5px;
    display:inline-block;
}

#navbar-nav {
    padding-left: 150px;
}

#contact {
    opacity: .9;
}

#button {
    background-color: blue;
    float: right;
}

#nav {
    margin-top: 9px;
    margin-right: 20px;
    display: inline-block;
}

.hero-unit {
    text-align: center;
    background-color: blue;
    font-size: 11px;
    margin: 30px;
    padding: 30px;
    line-height: 1.4em;
    -webkit-border-radius: 5px; 
    -moz-border-radius: 5px; 
    border-radius: 5px; 
    box-shadow: 1px 1px 10px #444;
    border-color: #C1C1C1;
    color: white; 
}

li {
    list-style-type: none;
    margin-top: 15px;
    margin-right: 12px;
    display: inline-block;
    font-size: 15px;
    /* color: white; */
}

a:link, a:visited, a:active {
    color: black;
}

a:hover {
    color: blue;
}

::-webkit-input-placeholder {
   font-family: helvetica;
   line-height: 1.8;
   font-size: 12px;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1;
}

h1 {
  font-size: 3em;
  letter-spacing: 4px;
  margin-bottom: 30px;
  text-align: center;
}

h4 {
  font-size: 2em;
  letter-spacing: -1px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: normal;
}

p {
  font-size: 1.1em;
  line-height: 1.7em;
}
1

There are 1 answers

0
Alien On BEST ANSWER

Change the css link order like below

<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="main.css">

is working fine http://jsfiddle.net/gtpco6k9/

in same selector , main.css will overwrite bootstrap.min.css

about css priority order, check out this post -> here