Tree menu
Tree menu
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css'/>
<style class="cp-pen-styles">* {
box-sizing: border-box;
}
ul {
margin: 0;
padding: 0;
list-style-type: auto;
}
a {
display: block;
padding: .2rem 0;
color: #000;
font-size: .875rem;
text-decoration: none;
float: left;
position: relative;
white-space: nowrap;
}
a:hover {
color: #992211;
text-decoration: underline;
}
h4 {
margin: .5rem 0 .75rem;
padding-bottom: .5rem;
border-bottom: 1px solid #ddd;
font-size: 1.25rem;
font-weight: normal;
}
h5 {
margin: 0;
margin-bottom: .5rem;
font-size: .875rem;
}
nav::after {
content: '';
display: block;
clear: both;
}
.menu {
display: inline-block;
border-radius: .2rem;
background: #fff;
position: relative;
z-index: 2;
}
.menu:hover {
box-shadow: 0 0 0.35rem 0 rgba(0, 0, 0, 0.5);
position: absolute;
}
.menu:hover > li {
display: block;
}
.menu:hover > li:first-child {
border-color: transparent;
border-bottom: none;
border-radius: .2rem .2rem 0 0;
background-color: #eee;
box-shadow: none;
position: relative;
z-index: 1;
color: #444;
cursor: default;
}
.menu:hover > li:first-child::after {
content: '\f106';
}
.menu:hover > li:last-child {
border-radius: 0 0 .2rem .2rem;
}
.menu:hover + .temp::after {
display: block;
}
.menu > li {
display: none;
width: 12rem;
margin: 0;
border-right: 1px solid #bbb;
}
.menu > li:first-child {
display: block;
padding: .65rem .65rem;
border: 1px solid #bbb;
border-radius: .20rem;
background: #fff;
box-shadow: 0 3px 3px -3px rgba(0, 0, 0, 0.5);
color: #000;
font-weight: bold;
font-size: .875rem;
cursor: pointer;
}
.menu > li:first-child::after {
content: '\f107';
float: right;
font: bold 1rem fontAwesome;
}
.menu > li:not(:first-child):hover {
width: calc(898px - 6rem);
border-right: none;
}
.menu > li:nth-child(2):hover::before {
content: '';
display: block;
width: 12rem;
height: 3rem;
border: 1px solid transparent;
position: absolute;
top: 0;
z-index: 10;
}
li h3 {
width: 12rem;
margin: 0;
padding: .65rem .75rem;
border: 1px solid transparent;
border-width: 1px 0;
background: #fff;
position: relative;
z-index: 10;
font-size: .875rem;
font-weight: normal;
cursor: default;
}
li:last-child h3 {
border-radius: 0 0 .2rem .2rem;
color: darkred;
}
li:last-child:hover h3 {
border-bottom-color: transparent;
border-radius: 0 0 0 .2rem;
}
li:hover h3 {
width: calc(12rem + 1px);
border-color: #bbb;
}
li:hover div {
display: block;
}
li div {
display: none;
width: calc(896px - 6rem - 12rem);
padding: 1rem 1.2rem;
border-left: 1px solid #bbb;
border-radius: 0 .2rem .2rem 0;
background: #fff;
position: absolute;
top: 0;
bottom: 0;
left: 12rem;
z-index: 1;
}
main {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
width: 100%;
height: 15rem;
margin-top: 2rem;
padding: 1rem;
background: #ccc;
position: relative;
z-index: 1;
clear: both;
}
main p {
margin: auto;
color: #555;
text-transform: uppercase;
letter-spacing: 1px;
}
::selection{background:#d58151;color:#fff;text-shadow:none}
::-moz-selection{background:#d58151;color:#fff;text-shadow:none}
@media (max-width: 60rem) {
.temp {
width: 67%;
}
}
</style>
<nav>
<ul class="menu">
<li>THỰC ĐƠN :D
</li>
<li>
<h3>Truyện cười</h3>
<div style="text-align: justify;overflow:auto;">
<h4>Sưu tầm</h4>
noidung
</div>
</li>
<li>
<h3>Hình Vui</h3>
<div style="text-align: justify;overflow:auto;">
<h4>Ảnh sưu tầm</h4>
noi dung
</div>
</li>
<li>
<h3>Toys</h3>
<div>
<h4>Brands</h4>
noidung
</div>
</li>
<li>
<h3>Sport & Leisure</h3>
<div style="text-align: justify;">
<h4>Sport</h4>
noidung
</div>
</li>
<li>
<h3>Home & Cooking</h3>
<div>
<h4>Cooking</h4>
noidung
</div>
</li>
<li>
<h3>Garden & DIY</h3>
<div style="text-align: justify;">
<h4>Garden</h4>
noidung
</div>
</li>
<li>
<h3>Gifts</h3>
<div style="text-align: justify;">
<h4>Gifts</h4>
noidung
</div>
</li>
<li>
<h3>Specials</h3>
<div style="text-align: justify;">
<h4>Specials</h4>
noidung
</div>
</li>
<li>
<h3>Specials 1</h3>
<div style="text-align: justify;">
<h4>Specials 1</h4>
noidung
</div>
</li>
<li>
<h3>Specials 2</h3>
<div style="text-align: justify;">
<h4>Specials 2</h4>
noidung
</div>
</li>
<li>
<h3>Specials 3</h3>
<div style="text-align: justify;">
<h4>Specials 3</h4>
noidung
</div>
</li>
<li>
<h3>Specials 4</h3>
<div style="text-align: justify;">
<h4>Specials 4</h4>
noidung
</div>
</li>
</ul>
</nav>