gpt4 book ai didi

html - 背景渐变不适用于 chrome(适用于 firefox)

转载 作者:太空宇宙 更新时间:2023-11-04 14:31:26 25 4
gpt4 key购买 nike

我想在浏览器中使用线性背景渐变。它适用于 FF,但不适用于 Chrome。我的 CSS 如下所示:

  /* works in FF */

background: -moz-linear-gradient(center top , rgb(40, 40, 40) 0px, rgb(10, 10, 10) 100%) repeat scroll 0% 0% transparent;


/* Not working in chrome */
background: -webkit-linear-gradient(center top , rgb(40, 40, 40) 0px, rgb(10, 10, 10) 100%) repeat scroll 0% 0% transparent;

怎么了?

最佳答案

根据我的评论,将来使用 Ultimate CSS Gradient Generator .

您还可以上传自己的 CSS 以生成浏览器兼容性样式

从您的 CSS:

background: -moz-linear-gradient(center top , rgb(40, 40, 40) 0px, rgb(10, 10, 10) 100%) repeat scroll 0% 0% transparent;

生成器输出:

background: #282828; /* Old browsers */
background: -moz-linear-gradient(left, #282828 0px, #0a0a0a 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0px,#282828), color-stop(100%,#0a0a0a)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #282828 0px,#0a0a0a 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #282828 0px,#0a0a0a 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #282828 0px,#0a0a0a 100%); /* IE10+ */
background: linear-gradient(to right, #282828 0px,#0a0a0a 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#282828', endColorstr='#0a0a0a',GradientType=1 ); /* IE6-9 */

JSFiddle

关于html - 背景渐变不适用于 chrome(适用于 firefox),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19134742/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com