I want to center my div
element with classes block and text-center
not only horizontally but vertically as well. I tried adding a margin-top
to it but this ends up separating its parent element #home
from the ul
above it. You need to sub in any jpeg
for my background
image of #home
(bolded below in my css) to see what I mean. I want the full image to be in display with the top of it touching the ul
as it is right now, but I also want to move the div inside of #home
downward without changing its size. How can I do this? Also please note I am using bootstrap css template, hence the class names.
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"/>
<link rel="stylesheet" type="text/css" media="all" href="css/animate.min.css"/>
<link rel="stylesheet" type="text/css" href="css/porfolioPage.css"/>
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<style>
</style>
</head>
<body>
<div class="container-fluid">
<ul id="contents" class="nav nav-pills">
<li>
<a href="#" id="productions">In Production</a>
</li>
<li class="pull-right">
<a href='#'>Contact</a>
</li>
<li class="pull-right">
<a href='#'>Portfolio</a>
</li>
<li class="pull-right">
<a href='#'>About</a>
</li>
<li class="pull-right">
<a href='#'>Home</a>
</li>
</ul>
<div id="home">
<div class="block text-center">
<h1 class="homeHeading">Sandoval Labs Incorporated</h1>
<h3 id="homeHeading">Developing</h3>
<div class="btnList">
<a class="btn btn-primary" href="#">Twitter</a>
<a class="btn btn-primary" href="#">Facebook</a>
<a class="btn btn-primary" href="#">Linkedin</a>
<a class="btn btn-primary" href="#">Github</a>
</div>
</div>
</div>
</div>
</body>
</html>
CSS:
body{
font-family: "avenir";
font-weight:500;
}
.nav-pills{
font-family:arial;
font-size:2.0em;
background-color:black;
}
#productions{
font-family:Lobster;
}
#home{
**background-image:url(snoopAndZuck.jpg);**
background-size:cover;
height:800px;
}
.btn-primary{
font-size:1.7em;
}
h1{
font-size: 4em;
}
.homeHeading{
margin:0 0 0 0;
padding:0px;
}
.block{
opacity:.7;
background-color: #000000;
padding:10px;
width:85%;
margin-left:auto;
margin-right:auto;
}