简体   繁体   English

如何删除面板底部的多余空白

[英]How to remove the extra white space at the bottom of the panels

I have a drop down menu system. 我有一个下拉菜单系统。 My drop down panels contains a list menu and 3 images. 我的下拉面板包含一个列表菜单和3张图像。

 #menu {width:1000px;margin:0px auto 0px auto} #menu #holder{ display: block; width: 100%; list-style:none;margin:0px;padding:0px; } #menu .menuaholder{margin:0;padding:0;display:inline-block;width:auto} #menu .menudropdown{z-index: 3;position:absolute;display:none;background-color:#ffffff;-moz-box-shadow: 0 0 6px #c4c4c4; -webkit-box-shadow: 0 0 6px #c4c4c4; box-shadow: 0 0 6px #c4c4c4;} #menu .menuaholder .full{padding:10px;width:980px;text-align:left;} #menu .menuitem{display:block;padding:5px;color:#000000;} #menu .menuitem:hover{background-color:#edf0f1;color:#B7B67E;} #menu .menuaholder:hover .menudropdown{display:table;} #menu a.item{ list-style-type: none; list-style-image: none; color: #999999; padding: 5px 6px 6px 6px; height: 15px; font-size: 12px; width: 100%; margin: 0px 0px 0px 0px; height: 30px; line-height: 30px; text-transform: uppercase; } .menudropdown .fourblocks .block{width:25%;margin:0px 0px 0px 0px;float:left} .menudropdown .fourblocks .block:last-child{margin-right:0px} .menudropdown .fourblocks{display:inline-block;margin-bottom:0px;width:980px} .twoblocks img, .fourblocks img, .menudropdown .fourblocks img, .threeblocks img, .unevenblocks img, .unevenblocks2 img{display:block;width:100%;height:auto;} 
 <div id="menu"> <div id="holder"> <div class="menuaholder even"><a href="index.html" class="item">Lighting</a><div class="menudropdown full"> <div class="fourblocks"> <div class="block"> <a href="wall-lights.html" class="menuitem" title="Wall Lights">Wall Lights</a> <a href="spot-lights.html" class="menuitem" title="Spot Lights">Spot Lights</a> <a href="pendant-lights.html" class="menuitem" title="Pendant Lights">Pendant Lights</a> <a href="chandeliers.html" class="menuitem">Chandeliers</a> </div> <div class="block"> <img src="http://lorempixel.com/200/200/" alt="LINK" title="LINK" width="200" height="200"></div> <div class="block"> <img src="http://lorempixel.com/200/200/" alt="LINK" title="LINK" width="200" height="200"></div> <div class="block forie"> <img src="http://lorempixel.com/200/200/" alt="LINK" title="LINK" width="200" height="200"></div> </div> </div></div> </div> </div> 

Here is a http://jsfiddle.net/s7yr93hj/ to show you. 这是一个http://jsfiddle.net/s7yr93hj/向您展示。

The panels have 10px padding around the contents, however at the bottom of the panels, I seem to have a gap larger than 10px, which I would like to remove. 面板的内容周围有10px的填充,但是在面板的底部,我似乎有一个大于10px的间隙,我想删除它。

My first thought was that the images were display:inline , but my styling includes display:block to remove any unwanted white space beneath them, however the problem still exists. 我最初的想法是图像是display:inline ,但是我的样式包括display:block以去除图像下方的任何不需要的空白,但是问题仍然存在。

The outer div seems to have a height greater than the contents. 外部div的高度似乎大于内容的高度。 The drop down panels will have varying heights, so I do not want to add height to the styling drop down panels 下拉面板的高度会有所不同,因此我不想在样式下拉面板中增加height

Does anyone have a solution to remove the extra white space? 有没有人有解决办法删除多余的空白?

Thank you. 谢谢。

Browser also renders white space on inline elements, the quick fix would be set the container font-size:0 and reset it to font-size:16px on the items. 浏览器还在内inline元素上呈现空白,快速修复方法是将容器上的font-size:0设置为项目,并将其重置为font-size:16px

But in your case you could just remove .menudropdown .fourblocks {display:inline-block;} all together, and set it to float:left if you want. 但是,在您的情况下,您可以只删除.menudropdown .fourblocks {display:inline-block;} ,并根据需要将其设置为float:left

Updated Demo: http://jsfiddle.net/s7yr93hj/1/ 更新的演示: http : //jsfiddle.net/s7yr93hj/1/

更改inline-blockinline.fourblocks DIV

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

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