2017-07-11 67 views
-1

如何刪除子類別和類別劃分之間的空間?

.category-list { 
 
    width: 20%; 
 
    margin-left: 50px; 
 
    position: fixed; 
 
    top: 50px; 
 
} 
 

 
#subcat1 { 
 
    width: 50%; 
 
    position: fixed; 
 
    top: 50px; 
 
    left: 350px; 
 
}
<div class="category-list" id="list-category"> 
 
    <div class="list-group"> 
 
    <a href="#" class="list-group-item" onmouseout="document.getElementById('subcat1').style.display = 'none';" onmouseover="document.getElementById('subcat1').style.display = 'block';">First item</a> 
 
    <div class="subcat" id="subcat1" style="display:none;" onmouseout="document.getElementById('subcat1').style.display = 'none';" onmouseover="document.getElementById('subcat1').style.display = 'block';"> 
 
     <div class="list-group"> 
 
     <a href="#" class="list-group-item">Second item</a> 
 
     <a href="#" class="list-group-item">Third item</a> 
 
     <a href="#" class="list-group-item">First item</a> 
 
     <a href="#" class="list-group-item">Second item</a> 
 
     <a href="#" class="list-group-item">Third item</a> 
 
     <a href="#" class="list-group-item">First item</a> 
 
     <a href="#" class="list-group-item">Second item</a> 
 
     <a href="#" class="list-group-item">Third item</a> 
 
     <a href="#" class="list-group-item">First item</a> 
 
     <a href="#" class="list-group-item">Second item</a> 
 
     <a href="#" class="list-group-item">Third item</a> 
 
     </div> 
 

 
    </div> 
 
    </div> 
 
</div>

兩個SUBCAT部門和類別divison在之間得到一個小的空間,但我想讓他們連接即使當檢查響應湖,如果我被擊中做出適當的左手食指和審判空間被刪除,但當我檢查響應性問題時,它再次出現。 我可以使用什麼,而不是固定的位置,以保持它們都連接! 在此先感謝

+0

你說的是什麼樣的空間? –

+0

我已經修復了category-list和subcat1的位置,因爲它們之間存在空間。我想要移除它們之間的空間 –

+0

爲什麼使用'fixed'定位。只需使用「親戚」即可。 –

回答

1

.category-list{ 
 
    width:20%; 
 
    margin-left:50px; 
 
    position: relative; 
 
    top:50px; 
 
    
 
    
 
} 
 
#subcat1{ 
 
    width:50%; 
 
    position:absolute; 
 
    top:0px; 
 
    right:0 
 
}
<div class="category-list" id="list-category"> 
 
       <div class="list-group"> 
 
       <a href="#" class="list-group-item" onmouseout="document.getElementById('subcat1').style.display = 'none';" onmouseover="document.getElementById('subcat1').style.display = 'block';" >First item</a> 
 
       <div class="subcat" id="subcat1" style="display:none;" onmouseout="document.getElementById('subcat1').style.display = 'none';" onmouseover="document.getElementById('subcat1').style.display = 'block';"> 
 
         <div class="list-group"> 
 
          <a href="#" class="list-group-item">Second item</a> 
 
          <a href="#" class="list-group-item">Third item</a> 
 
          <a href="#" class="list-group-item">First item</a> 
 
          <a href="#" class="list-group-item">Second item</a> 
 
          <a href="#" class="list-group-item">Third item</a> 
 
          <a href="#" class="list-group-item">First item</a> 
 
          <a href="#" class="list-group-item">Second item</a> 
 
          <a href="#" class="list-group-item">Third item</a> 
 
          <a href="#" class="list-group-item">First item</a> 
 
          <a href="#" class="list-group-item">Second item</a> 
 
          <a href="#" class="list-group-item">Third item</a> 
 
         </div> 
 

 
       </div> 
 
</div> 
 
</div>

+0

這是你想達到的目的嗎? – SamB

+0

差不多,但我已經使用引導類,但是當我檢查類別列表分區變化的響應寬度,並進一步subcat分區正在重疊 –

+0

也許我想停止引導程序在類別列表分區 –

相關問題