边框颜色:rgba() 边框在角处重叠,颜色比预期更深
使用以下代码:
element{
width:300px;
border:9px solid;
border-color:rgb(0,0,0);
border-color:rgba(0,0,0, 0.7);
}
由于两个边框的重叠,我最终得到的角更暗......我发现解决此问题的唯一方法是添加等于宽度的 border-radius
的边界。还有其他解决方法吗?
我目前只在 Chrome 中进行了测试,目前还没有其他浏览器可用。
Using the following code:
element{
width:300px;
border:9px solid;
border-color:rgb(0,0,0);
border-color:rgba(0,0,0, 0.7);
}
I end up with corners that are darker due to the overlay of the two borders... the only way I have found around this is to add a border-radius
equal to the width of the border. Are there any other work arounds?
I have only tested in chrome at the moment, I don't have my other browsers available right now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在表格上使用
border-spacing
,如下所示:与一些漂亮的 CSS 选择器结合使用,以防止边框重叠(见下文)。这将适用于除最后一项之外的所有 td。
请参阅 jsFiddle 上的演示
然后您就可以使用不重叠的 rgba 边框。
Use
border-spacing
on your table like so:Combine with some nice CSS selectors to keep borders from overlapping (see below). This will apply to all tds except the last one.
See Demo on jsFiddle
Then you can use rgba borders without overlap.
它不是很优雅,但您可以制作一个带有实心边框和不透明度值的包装
:http://jsfiddle.net/4gutj/24/
HTML:
CSS:
It's not very elegant, but you could make a wrapping
<div>
with a solid border and an opacity value: http://jsfiddle.net/4gutj/24/HTML:
CSS:
同样不是很优雅但有效的是:
颜色差异导致颜色以 45% 的角度相遇。您也可以像这样创建斜角。
Also not very elegant but works is:
The color differences cause the colors to meet at a 45% angle. You can also create bevels like this.
由于大多数 浏览器支持 box-shadow,您可以像这样使用它:
Since most browsers support box-shadow, you can use it like that: