简体   繁体   English

Background-clip在我的代码中不起作用。 (边界半径/背景出血问题)

[英]Background-clip not working in my code. (Border-Radius/Background bleeding issue)

I'm trying to style the default progressbar skin of jquery-ui. 我正在尝试设置jquery-ui的默认进度栏皮肤的样式。 Unfortunately I've discovered an issue that is known as "background bleeding". 不幸的是,我发现了一个称为“背景出血”的问题。 Apparently the solution for this problem is to use: 显然,此问题的解决方案是使用:

-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;

However it does not seem to work for me, no matter where I put it. 但是,无论放在哪里,它似乎都不适合我。 :( :(

Image of my background bleeding issue (zoomed) 我的背景出血问题的图像(已缩放)

在此处输入图片说明

Source: 资源:

 $(function() { var myProgressBar = $("#myProgressBar"); myProgressBar.progressbar({ value: 50 }); }); 
 #myProgressBar { width: 580px; height: 92px; border: none; /* black background */ background-color: black; background-image: linear-gradient(rgba(255, 255, 255, 0.25) 50%, transparent 50%, transparent); } #myProgressBar .ui-widget-header { /* orange foreground */ background-color: orange; background-image: linear-gradient(rgba(255, 255, 255, 0.2) 50%, transparent 50%, transparent); } 
 <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.css"/> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script> <div id="myProgressBar"></div> 

Here is a workaround: I set a smaller border-radius for the inner rectangle (orange bar), to hide the blurry leaking part of the parents (black background) rounded border. 这是一种解决方法:我为内部矩形(橙色条)设置了较小的边框半径,以隐藏父母(黑色背景)圆形边框的模糊泄漏部分。 I'll mark this question as solved as the workaround is good enough for my purpose. 我将这个问题标记为已解决,因为该解决方法足以满足我的目的。 Sadly this issue remains a bug/flaw in CSS. 遗憾的是,此问题仍然是CSS中的错误/缺陷。

Edit: Alright, have to wait 2 days before I can actually close it. 编辑:好的,必须等2天才能真正关闭它。 Please don't delete it again. 请不要再次删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM