0

我想替换以下 Mozilla 特定的 CSS 规则:

background: -moz-linear-gradient(center top , #F5F5F5, #E4E4E4); 

使用使用标准的等效规则linear-gradient。换句话说,我怎样才能完成以下规则,使其具有与上述规则相同的效果(在 Firefox 中)

background: linear-gradient /* what goes here? */
4

3 回答 3

1

这就是我处理所有浏览器的所有渐变的方式,我希望这会有所帮助;

background: -moz-linear-gradient(top,  rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
background: linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */
于 2012-04-25T20:18:35.153 回答
1

如果您遇到一些困难或只是为了加快进程,您也可以使用一些梯度生成器。
示例: http:
//www.colorzilla.com/gradient-editor/
http://westciv.com/tools/gradients/
http://gradients.glrzad.com/

于 2012-04-25T20:24:40.727 回答
0

center不是线性梯度规范的一部分。(我不知道为什么它被忽略而不是 CSS 错误。)然而,据我所知,Firefox 支持的最新语法-moz-linear-gradient(to bottom, #F5F5F5, #E4E4E4);尚未达到 CR 状态,所以这仍然可能会改变。

于 2012-04-25T20:44:27.197 回答