2015-07-05 257 views
4

我有一個圖像,它需要在底部的羽化效果。如何獨自使用css3如何在圖像中製作羽毛?

一個例子,我把我的兩個featheredno-feathered圖像中的demo

with feather

Without feather 任何一個請建議我正確的方式在底部添加羽毛?

Live Demo

+0

就在它添加一個漸變?你有什麼嘗試? – Jonathan

+0

圖像的高度不同,因此難以產生理想的效果。如果您將底部圖像替換爲與頂部圖像完全相同的底部圖像,但沒有對其的影響,則將更容易重新創建。 – 2ne

回答

3

CSS3梯度用於在這裏實現了羽毛的效果。由於羽毛在底部,因此可以使用linear-gradient的值to bottom和百分比值。即處於各種停工級別。

在每個停工級別更改opacity以實現更平滑的效果。

.shadow { 
 
    background: url(https://dl.dropboxusercontent.com/u/10268257/Feather/withFeather.png) no-repeat; 
 
    height: 216px; 
 
    width: 215px; 
 
} 
 
.no-shadow { 
 
    background: linear-gradient(to bottom, rgba(22, 49, 102, 0) 0%, rgba(22, 49, 102, 0) 80%, rgba(22, 49, 102, 0.99) 87%, rgba(22, 49, 102, 1) 100%), url(https://dl.dropboxusercontent.com/u/10268257/Feather/withoutFeather.png); 
 
    display: inline-block; 
 
    height: 216px; 
 
    width: 215px; 
 
}
<div class="no-shadow"></div> 
 
<div class="shadow"></div>

+0

這不適合我,你可以在這裏檢查嗎? http://jsfiddle.net/ymatcamj/ – user2024080

+0

你們都使用'與羽毛'PNG圖像。這裏沒有梯度工作。 – user2024080

+0

你可以從div中刪除'withFeather.png'圖像嗎?我仍然沒有得到結果。 – user2024080