左侧固定,右侧是竖着的子菜单样式

body {
    font-family:"微软黑体";
    background-color:white;
}
* {
    margin:0;
    padding:0;
    list-style:none;
}
a {
  text-decoration:none;
  color:red;
}
a:link {
  text-decoration:none;
}
a:active {
    text-decoration:none;
}
a:hover {
    text-decoration:none;
}
a:visited {
    text-decoration:none;
}
div {
    position:absolute;
    top:10px;
    left:10px;
    bottom:10px;
    width:80%;
    height:auto;
}
.nav_left {
    width:100px;
    height:30px;
    line-height:30px;
    position:relative;/*注意:要让子标签和该父标签top在同一个位置,则必须设置该属性值为relation*/
    background-color:blue;
    color:white;
    left:10px;
    top:10px;
}
.nav_right {
    width:100px;
    height:auto;
    line-height:30px;
    position:absolute;/*注意:这个属性也不能少*/
    top:0px;
    left:100px;
    display:none;
    background-color:#b6ff00;
    white-space:nowrap;
    text-overflow:ellipsis;
    -o-text-overflow:ellipsis;
    overflow:hidden;

}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>右侧二级菜单二</title>
    <script src="/Scripts/jquery-1.10.2.min.js"></script>
    <link href="/CSS/basecss1.css" rel="stylesheet"/>


    <script>
        $(function () {
            $(".nav_left").hover(function () {


                $(".nav_right", this).show();


            });
            $(".nav_left").mouseleave(function () {
                $(".nav_right", this).hide();
            });
        })
    </script>
</head>
<body>
     <div>
       <ul>
        <li class="nav_left">
        <a>第一页</a>
          <ul class="nav_right">
          <li>1</li>
          <li>2</li>
          </ul>
        </li>
        <li class="nav_left">
         <a>第二页</a>
         <ul class="nav_right">
            <li>21</li>
            <li>22</li>
         </ul>
        </li>
      <li class="nav_left">
         <a>第三页</a>
         <ul class="nav_right">
           <li>3</li>
         </ul>


      </li>
       </ul>
     </div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值