我制作了一个CSS进度条,使用了两个重叠的元素。元素的CSS如下:
<code>#</code>status_progressbar {
height: 22px;
width: 366px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
background: #000;
cursor: pointer;
}
<code>#</code>status_progressbar_progress {
height: 22px;
background: #eee;
float: right;
-moz-border-radius: 0 10px 10px 0;
-webkit-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
/* width controlled by Rails backend, using inline style */
}
很不幸,正如您在这张图片中清晰地看到的那样,父元素的背景在右边部分可见。由于子元素的背景应该完全覆盖父元素,我不知道为什么会出现这种情况。
[此图片在Firefox 4中拍摄]
也许有人能解释一下为什么会发生这种情况以及如何解决它?