2017-03-22 42 views
0

我有一個div一個div裏面,如何適應曲線div內的div?

<div style="background-color: red; height: 100px; width: 100px; border-radius: 10px;" id="div1"> 
     <div style="background-color: orange;" id="div2"> 
      testing 
     </div> 
</div> 

DIV2它坐落在DIV1的頂部,不DIV1的曲線一致。

即使我改變DIV2的圓角半徑,我不能DIV1的半徑曲線完全一致。如何刪除div2這是超出div1曲線以外?

的jsfiddle here

+0

請爲此創建一個jsfiddle。 –

+1

https://jsfiddle.net/sjj3k6br/ – meyer9

回答

2

這裏,我們去:添加溢出:隱藏

<div style="background-color: red; height: 100px; width: 100px; border-radius: 10px; overflow:hidden" id="div1"> 
 
     <div style="background-color: orange;padding-left:5px" id="div2"> 
 
      testing 
 
     </div> 
 
</div>

1

你必須告訴家長,以隱藏其子的溢出:

overflow: hidden;上DIV1