2014-09-23 84 views
3

我期待在主圓圈中包含的圓的底部創建一個黑色面具。CSS圓形面具

你能用css掩碼做這個嗎?

請參閱fiddle

<div id="profile-pic-wrap"> 
    <div id="profile-pic"> 
    <div class="profile-btn-bg"> 
     <a href="#" class="profile-pic-btn">Change Profile</a> 
    </div> 
    </div> 
</div> 

感謝

+2

把它放在圓圈內有'溢出:hidden'紅圈? – 2014-09-23 09:53:58

回答

6

您可以使用overflow:hidden;

DEMO

更改您CSS:添加overflow:hidden;text-align:center到​​

#profile-pic { 
 
\t position: absolute; 
 
\t z-index: 999; 
 
\t width: 200px; 
 
\t height: 200px; 
 
\t left: 33px; 
 
\t background: #FFF; 
 
\t border: 3px solid #FFF; 
 
\t border-radius: 100px; 
 
\t -webkit-border-radius: 100px; 
 
\t -moz-border-radius: 100px; 
 
\t top: 0px; 
 
\t position: relative; 
 
    background:red; 
 
    overflow:hidden; 
 
    text-align:center; 
 
} 
 
.profile-btn-bg{ 
 
\t position: absolute; 
 
\t background-color: black; 
 
\t width: 100%; 
 
\t height: 30%; 
 
\t bottom: 0px; 
 
} 
 

 
a.profile-pic-btn{ 
 
\t color: #fff; 
 
    
 
}
<div id="profile-pic-wrap"> 
 
    <div id="profile-pic"> 
 
    <div class="profile-btn-bg"> 
 
     <a href="#" class="profile-pic-btn">Change Profile</a> 
 
    </div> 
 
    </div> 
 
</div>