Im having issues with my dropdown menu. I added a padding in my Ul line so my menu would align in the center, but after that the dropdown items will not align. I'm sure the problem is in my CSS, but i will include both HTML and CSS. Ive been told some of this code is redundant, but for this problem I would like to leave it like it is.
body {
background: url('https://static.pexels.com/photos/39811/pexels-photo-39811.jpeg') no-repeat;
Background-size: cover;
font-family: arial;
color: white;
}
ul {
margin: 0px;
padding: 0px;
list-style: none;
padding-left:70px;
}
ul li {
float: left;
width: 200px;
height: 40px;
background-color: black;
opacity: 0.8;
line-height: 40px;
text-align: center;
font-size: 20px;
}
ul li a{
text-decoration: none;
color: white;
display: in-line;
}
ul li a:hover {
background-color: gray;
}
ul li ul li {
display: none;
}
ul li:hover ul li {
display: block;
}
<htlm>
<link href='style2.css' rel='stylesheet'>
<ul>
<li><a>Home</a></li>
<li><a>About</a>
<ul>
<li><a>About Me</a></li>
<li><a>About My Project</a></li>
</ul>
</li>
<li><a>Gallery</a></li>
<li><a>Contact</a></li>
<li><a>News</a>
<ul>
<li><a>Tech News</a></li>
<li><a>World News</a></li>
<li><a>Science News</a></li>
</ul>
</li>
<li><a>Lessons</a></li>
</ul>
</html>
<htlm>and</le>) that are typos. It may be worth validating your markup with the W3 Markup Validator service.<html>and</li>respectively. The<html>denotes that the file is an HTML document, and you already have the corresponding</html>tag at the end. Most of your list items are closed with</li>(ending the list item), though one is closed with</le>(resulting in invalid syntax, and unexpected display).