Change height-top of item when hover

前端 未结 2 465
渐次进展
渐次进展 2021-01-28 10:57

I want to create a menu. When I hover, height-top of item will change like

\"enter

2条回答
  •  爱一瞬间的悲伤
    2021-01-28 11:15

    pls see my solution, it works well in ie6+, firefox, chrome and so on. Online demo: http://jsbin.com/oTOv/1/

    *{margin:0; padding:0;}
        #menu ul {
            margin: 50px 0 0;
            padding: 0px;
            list-style-type: none;
        }
        #menu li {
            float:left;
        }
        #menu a {
            display: block;
            width: 8em;
            height:20px;
            line-height:20px;;
            color: white;
            background-color: #000099;
            text-decoration: none;
            text-align: center;
        }
    
        #menu a:hover {
            position:relative;
            height: 30px;
            line-height:30px;
            background-color: #6666AA;
            margin-top: -10px;
            background-color: #6666AA;
        }
    

提交回复
热议问题