2017-07-16 97 views

回答

0

對於該行用作分隔符,可以使用右側的邊框,但我建議對右側的框使用左側的邊框。 只需使用兩個帶顯示的div:內聯屬性和每個寬度:50%;

0
<style> 
.div1{ 
    width:45%; 
    height:50%; 
    float:left; 
    background-color: blueviolet; 
    } 
    .div2{ 
     background-color: aquamarine; 
    width:45%; 
    height:50%; 
    float:left; 
    } 
</style> 
<div class="div1"></div> 
<div class="div2"></div> 

enter image description here

0

可選地,使用一個Flexbox的用隔離div

.container { 
 
    display: flex; 
 
    height: 3em; 
 
} 
 

 
.left { 
 
    background-color: blue; 
 
    width: 40%; 
 
} 
 

 
.separator { 
 
    width: 1px; 
 
    background-color: darkgray; 
 
} 
 

 
.right { 
 
    background-color: red; 
 
    width: 40%; 
 
}
<div class="container"> 
 
    <div class="left"></div> 
 
    <div class="separator"></div> 
 
    <div class="right"></div> 
 
</div>

0

試試這個:

.c1, .c2 { 
 
    width: 200px; 
 
    height: 200px; 
 
    float: left; 
 
} 
 

 
.c1 { 
 
    background-color: red; 
 
} 
 

 
.c2 { 
 
    background-color: blue; 
 
    border-left:1px solid #000; 
 
}
<div class="c1"></div> 
 
<div class="c2"></div>

相關問題