简体   繁体   English

HTML下拉菜单删除LI元素之间的空白

[英]HTML Dropdown Menu remove white space between LI element

I'm using image as dropdownlist items and found that there are unnecessary white space in between each of the element and hence wondering if it's possible to remove all of the white spaces 我将图像用作下拉列表项,发现每个元素之间没有多余的空格,因此想知道是否有可能删除所有空格

<html>
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="demo.css">
</head>
<body>
    <div id='wrap'>
        <div id="clickable_div">MENU</div>
            <div id="nav_menu">
                <ul class="dropDown">
                    <li><img src="ori_12.png"></li>
                    <li><img src="ori_12.png"></li>
                    <li><img src="ori_12.png"></li>
                    <li><img src="ori_12.png"></li>
                </ul>
            </div>
        </div>
    </div>

</body>
<script>
        $('#wrap').mouseover( function(){
            $('#nav_menu').slideDown();
        })
        $('#wrap').mouseleave( function(){
            $('#nav_menu').slideUp();
        });

    </script>
</html> 

And below is my Demo.css : 下面是我的Demo.css

#clickable_div {width:166px; background-color:#9c9c9c;}
*{margin:0; padding:0}
#nav_menu{width:166px; height:auto; background-color:#CCC;display:none;}

#wrap{ width:166px }
 <style>
    li{
        display: block;
        border: 0px;
    }
</style>

add this style hope it will work 添加此样式,希望它能起作用

It's hard to tell without jsfiddle but I would add display:block; 没有jsfiddle很难说,但是我会添加display:block;。 to images in li.. 到li中的图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM