使径向渐变半径为 200px
如何使半径的宽度和高度均为 200px?我读到这可以以像素为单位完成,但每次尝试都失败了。
background-image: -webkit-radial-gradient(75% 100%, circle farthest-corner, #ffffff, #ff7ae9 33%);
background-image: -o-radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%);
background-image: -ms-radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%);
background-image: radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%)
background-image: -moz-radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%);
How would I make the radius 200px in width and height? I've read that this can be done in pixel units, but every attempt has failed.
background-image: -webkit-radial-gradient(75% 100%, circle farthest-corner, #ffffff, #ff7ae9 33%);
background-image: -o-radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%);
background-image: -ms-radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%);
background-image: radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%)
background-image: -moz-radial-gradient(75% 19%, circle farthest-corner, #ffffff, #ff7ae9 33%);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:针对现代语法进行了更新,我在下面保留了原始语法以记录 2011 年语法
您可以设置半径并以像素值或任何其他有效的 长度单位。
在下面的示例中,
circle at 200px 200px
将圆的中心点设置为横向 200 像素,向下 200 像素,这也可以是 背景位置,例如左侧或顶部。接下来的值是色标,并且是逗号分隔的
颜色长度
对。同样, color 和 长度 可以使用red 10%
,#333 10px
和rgb(10,47,10) 1em
都有效。像 px 或 em 这样的值是绝对值,百分比值是相对于渐变容器的。
原始答案:
edit: Updated for modern syntax, I've left the original below for a record of the 2011 syntax
You can set both the radius and position the gradient in pixel values or any other valid length unit.
In the example below
circle at 200px 200px
is setting the center point of the circle to 200px across and 200px down, this could also be any value accepted by background-position such as left or top.The next values are the color stops and are comma separated pairs of
color length
. Again any valid value of color and length would workred 10%
,#333 10px
andrgb(10,47,10) 1em
would all be valid.Values like px or em are absolute and percentage values would be relative to the gradient container.
Original Answer: