We would like to know how to hover to show sub UL li.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ul, li {<!--from ww w. j ava2 s . c o m-->
list-style: none;
margin: 0;
padding: 0;
color: #fff;
}
li {
background-color: red;
}
ul#root>li {
background-color: blue;
display: inline-block;
position: relative
}
ul#root>li>ul {
position: absolute;
display: none;
border-top: 10px solid rgba(255, 0, 0, 0);
}
ul#root>li:hover>ul {
position: absolute;
display: block;
}
</style>
</head>
<body>
<ul id="root">
<li>Item 1
<ul>
<li>Subitem 1</li>
</ul>
</li>
<li>Item 2
<ul>
<li>Subitem 2</li>
</ul>
</li>
</ul>
</body>
</html>
The code above is rendered as follows: