I'm making a simple site that has multiple html items (in this case h1
, ul
, li
, div class ="test"
).
For some reason, two items don't show up in the correct order. I have a ul
that has multiple li
entries. Under that (in my code at least) I have a p
.
However, when I run the HTML file, the ul
uses the p
as a point of reference for positioning itself with margin-top: 110px;
. It's really stumping me. If you would like to see my code and run it for yourself, here you go:
Here is a Demo of the code:
<!DOCTYPE html>
<head>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
<style>
body {
text-align: center;
background-image: url(https://classconnection.s3.amazonaws.com/114178/flashcards/759682/jpg/cumulus.jpg);
background-size: 100%;
font-family: 'Open Sans', sans-serif;
}
h1 {
text-align: center;
font-size: 50px;
color: #CE4F04;
background-color: white;
margin-left: -10px;
margin-top: 15px;
margin-right: -10px;
padding-top: 10px;
padding-bottom: 10px;
font-family: 'Pacifico', cursive;
}
ul {
left: 10px;
right: 10px;
position: fixed;
margin-top: 110px;
background-color: aliceblue;
text-align: center;
}
li {
display: inline;
padding-right: 10px;
padding-left: 10px;
}
.navigation-bar-items {
font-size: 30px;
color: grey;
}
.container {
position: fixed;
top: 0;
left: 0;
right: 0;
text-align: center;
}
.mainLogo {
text-align: center;
font-size: 50px;
color: #CE4F04;
background-color: white;
margin-left: -10px;
margin-top: 15px;
margin-right: -10px;
padding-top: 10px;
padding-bottom: 10px;
font-family: 'Pacifico', cursive;
}
.main {
max-width: 1000px;
background-color: aquamarine;
margin-top: 1000px;
}
.test {
margin-top: 200px;
}
</style>
</head>
<body>
<header>
<div class="container">
<h1>Welcome to my blog</h1>
</div>
<ul>
<div class="navigation-bar-items">
<li>Home</li>
<li>About me</li>
<li>Social</li>
<li>Contact Me</li>
<li></li>
</div>
</ul>
</header>
<div class="test">Hello</div>
</body>