2017-08-10 82 views

回答

0

我想你想要的是border-radius

.inner { 
 
    background: #FFB6C1; 
 
    width: 40px; 
 
    height:20px; 
 
    border-radius: 20px; 
 
} 
 

 
.outter { 
 
    width:100px; 
 
    border: 1px solid #ccc; 
 
    border-radius: 20px; 
 
}
<div class="outter"> 
 
    <div class="inner"></div> 
 
</div>

+0

唯一的问题是,当内部是如此之小,那么半径将打破 https://jsfiddle.net/z124ey03/ –

+0

在外部div上使用'overflow:hidden;'。 –