I am facing an issue with my navigation menu in the design. The sub menu is not displaying when hovered. Is there a solution to fix this problem? Could it be due to missing CSS styles?
nav ul {list-style-type: none; overflow: hidden; background: #000; position: relative;}
nav li {float: left;}
nav li > a {padding: 15px 15px; display: inline-block; text-decoration: none; color: white; text-align: center;}
nav li > a:hover {background: violet;}
nav ul ul { position: absolute; background: green; top: 100%;}
nav ul ul li > a:hover {color: red;}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>sample UL</title>
<style media="screen">
</style>
</head>
<body>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Menu 1</a></li>
<ul>
<li><a href="#">submenu 1</a></li>
<li><a href="#">submenu 2</a></li>
</ul>
</ul>
</nav>
</body>
</html>