簡體   English   中英

之間的差距 <ul> 和 <div> 在IE7中

[英]Gap Between <ul> and <div> in IE7

我無法診斷導致頁面某一部分出現間隙的原因。 我搜索了SO和Google,但我無法查明任何有用的文章。 我有一個容器,其中包含一個標題,一個無序列表和一個包含信息的div。 問題是div和ul之間出現了差距。 我希望div直接在ul下沒有空格。 這里可以看到一個例子: http//jsfiddle.net/aAfU5/1/ (記住IE7)

HTML

<div id="center-panel">
  <h1>Information</h1>
    <ul class="clearfix">
      <li class="bg1 border2">Regulation</li>
      <li class="bg1 border2">Compliance</li>
      <li class="bg1 border2">Resources</li>
    </ul>
    <div id="information-panel" class="border2">
      This is where the content goes
    </div>
  </div>

CSS:

    #center-panel {
        height: 300px;
        float: left;
        width: 78%;
        padding: 5px;
    }

    #center-panel ul {
        padding: 0px;
        margin: 0px;
    }

    #center-panel li {
        color: white;
        /*display:inline-block;*/
        /*display:inline;*/
        float: left;
        font-weight: bold;
        list-style-type: none;
        margin: 0px 2px;
        padding: 3px;
        width: 100px;
    }

    #information-panel {
        clear: both;
        margin: 0px 2px;
    }

    h1 {
        margin: 0 0 10px 0;
        padding: 0;
        font-size: 120%;
        color: #01305E;
    }

    .bg1 {
        background: #3C698E;
    }

    .border2 {
        border: 1px solid #01305E;
    }

這是你的H1邊際在ul下“溢出”。 用填充物替換它:

h1 {
  margin: 0;
  padding: 0px 0px 10px 0px;
  font-size: 120%;
  color: #01305E;
}

您還可以添加縮放以觸發haslayout

#center-panel ul {
  padding: 0px;
  margin: 0px;
  zoom:1;
 }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM