I've been playing around with some HTML/CSS code and I'm having trouble positioning a h5 element. Every time I try to position it, the top bar shifts down. It's supposed to be aligned flush with the top of its container. Here's the code snippet:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Hello world!</title>
<link rel="stylesheet" href="css/main.css" type="text/css"/>
<script src="js/site.js"></script>
</head>
<body>
<!-- window wrapper -->
<div id="wrapper">
<!-- top bar -->
<div id="top_bar">
<!-- title -->
<h6 class="title">Hello</h6>
</div>
</div>
</body>
</html>
Here is the corresponding CSS code:
body {
font-family: "Helvetica Neue";
background: url("http://media.idownloadblog.com/wp-content/uploads/2014/06/Yosemite-Preview.jpg");
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center center;
}
#wrapper {
height: 500px;
width: 1000px;
border: 1px solid black;
border-radius: 5px;
box-shadow: 5px 5px 10px gray;
}
#top_bar {
background: linear-gradient(rgba(220,220,220,0.8),rgba(225,225,225,0.8),rgba(215,215,215,0.8));
margin-top: 0px;
height: 50px;
width: 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom: 1px solid black;
}
.title {
text-align: center;
}
I would really appreciate any help or guidance on what might be causing this issue.
P.S. Please ignore the background image for now.