导航下面的二级导航,显示和隐藏,

Original 2019-03-11 17:15:02 401
abstract:<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } .nav{ height: 40px; bac

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<style>

*{

margin: 0;

padding: 0;

}

.nav{

height: 40px;

background: #ccc;

}

.odiv{

width: 500px;

margin: auto;

}

.odiv li{

list-style: none;

width:100px;

height:40px ;

float:left;

line-height: 40px;

text-align: center;

color: white;

position: relative;

cursor: pointer;

}

.box{

position: absolute;

width: 100px;

height: 120px;

left:0;

display: none;

}

.box li{

width: 100px;

height: 40px;

background: red;

}

.odiv li:hover .box{

display: block;

}

.box li:hover {

color: yellow;

background: #ccc;

}

.first:hover{

background: pink;

}


</style>

</head>

<body>

<div class="nav">

<ul class="odiv">

<li class="first">导航1

<ul class="box">

<li>(1)导航一</li>

<li>(2)导航一</li>

<li>(3)导航一</li>

<li>(4)导航一</li>

</ul>

</li>

<li>导航2</li>

<li>导航3</li>

<li class="first">导航4

<ul cla


ss="box">

<li>(1)导航一</li>

<li>(2)导航一</li>

<li>(3)导航一</li>

<li>(4)导航一</li>

</ul>

</li>

<li>导航5</li>

</ul>

</div>

</body>

</html>


Correcting teacher:韦小宝Correction time:2019-03-11 17:32:19
Teacher's summary:写的很不错 css来实现下拉菜单还是蛮简单的 总的来说要比js来实现简单多了

Release Notes

Popular Entries