2012-10-19 47 views
2

enter image description here如何設置文本框的按鈕漸變顏色?

我想設計一個文本框和textarea,它們裏面有一些漸變效果看起來像上面的img。

我找到一種方法將它設置在按鈕上。

但我無法修復它到textarea。

+0

附上請 – RomanTheGreat

+0

我只需要一個textarea的背景的CSS的CSS和HTML的例子.. – Babu

+0

會上傳我的CSS幾分鐘之內。我刪除了我以前的 – Babu

回答

3

您可以檢查這個 Ultimate Gradient GeneratorCss Portals。這將滿足您的需求。

因此,你沒有插入你的CSS和HTML。我們可以做到這一點。

如果你需要使用的代碼如下

.gradient_effect{ 
background: rgb(252,255,244); /* Old browsers */ 
background: -moz-linear-gradient(top, rgba(252,255,244,1) 0%, rgba(223,229,215,1)  40%, rgba(179,190,173,1) 100%); /* FF3.6+ */ 
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(252,255,244,1)), color-stop(40%,rgba(223,229,215,1)), color-stop(100%,rgba(179,190,173,1))); /* Chrome,Safari4+ */ 
background: -webkit-linear-gradient(top, rgba(252,255,244,1) 0%,rgba(223,229,215,1) 40%,rgba(179,190,173,1) 100%); /* Chrome10+,Safari5.1+ */ 
background: -o-linear-gradient(top, rgba(252,255,244,1) 0%,rgba(223,229,215,1) 40%,rgba(179,190,173,1) 100%); /* Opera 11.10+ */ 
background: -ms-linear-gradient(top, rgba(252,255,244,1) 0%,rgba(223,229,215,1) 40%,rgba(179,190,173,1) 100%); /* IE10+ */ 
background: linear-gradient(to bottom, rgba(252,255,244,1) 0%,rgba(223,229,215,1) 40%,rgba(179,190,173,1) 100%); /* W3C */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0); /* IE6-9 */ 
.text_box-border:double 5px #000000; 
-moz-border-radius-topleft: 8px; 
-moz-border-radius-topright:8px; 
-moz-border-radius-bottomleft:8px; 
-moz-border-radius-bottomright:8px; 
-webkit-border-top-left-radius:8px; 
-webkit-border-top-right-radius:8px; 
-webkit-border-bottom-left-radius:8px; 
-webkit-border-bottom-right-radius:8px; 
border-top-left-radius:8px; 
border-top-right-radius:8px; 
border-bottom-left-radius:8px; 
border-bottom-right-radius:8px; 
-moz-box-shadow: 10px 10px 5px #8c898c; 
-webkit-box-shadow: 10px 10px 5px #8c898c; 
box-shadow: 10px 10px 5px #8c898c; 
} 
+1

優秀的工作。這樣的答案使得stackoverflow最好。掙扎了一個小時後,我得到了解決方案:) – Gogol

0
#gradient { 
    background: -webkit-gradient(linear, center top, center bottom, color-stop(0%, #ccc), color-stop(100%, #fff)); 
    background: -moz-linear-gradient(top, #ccc, #fff); 
} 

這一個#grandient作爲輸入框

使用的ID生成您的梯度: http://www.colorzilla.com/gradient-editor/

2
textarea { 
    background: -webkit-linear-gradient(red, black); 
    background: -moz-linear-gradient(top, red, black); 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#000000'); 
}​ 

http://jsfiddle.net/EjFUd/

編輯:打我吧!

1
​textarea { 
    background: rgb(255, 255, 255); 
    background: -moz-linear-gradient(270deg, rgb(255, 255, 255) 75%, rgb(230, 230, 230) 100%); 
    background: -webkit-linear-gradient(270deg, rgb(255, 255, 255) 75%, rgb(230, 230, 230) 100%); 
    background: -o-linear-gradient(270deg, rgb(255, 255, 255) 75%, rgb(230, 230, 230) 100%); 
    background: -ms-linear-gradient(270deg, rgb(255, 255, 255) 75%, rgb(230, 230, 230) 100%); 
    background: linear-gradient(270deg, rgb(255, 255, 255) 75%, rgb(230, 230, 230) 100%); 
}​ 

Exmpl - http://jsfiddle.net/VSpB8/

更多的CSS3發電機 - http://css3gen.com/gradient-generator/

1

這裏試試這個:[注:調整ü希望的顏色]

CSS:

#gradientTextarea { 
background: -moz-linear-gradient(top, #ffffff 0%, #f5f5f5 100%);/FF3.6+/
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#f5f5f5));/Chrome,Safari4+/
background: -webkit-linear-gradient(top, #ffffff 0%,#f5f5f5 100%);/Chrome10+,Safari5.1+/
background: -o-linear-gradient(top, #ffffff 0%,#f5f5f5 100%);/Opera 11.10+/
background: -ms-linear-gradient(top, #ffffff 0%,#f5f5f5 100%);/IE10+/
background: linear-gradient(to bottom, #ffffff 0%,#f5f5f5 100%);/W3C/
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5',GradientType=0); 
border:1px solid #f5f5f5; 
} 

html

<textarea id="gradientTextarea"></textarea>