Html 白色背景下不可见星级

Html 白色背景下不可见星级,html,css,Html,Css,所以我使用了网站上的代码在我的网页上显示星级组件。早些时候,它工作正常,但当我将网页背景更改为黑色(图像),主容器背景更改为白色时,星形图像消失,我尝试修复它,发现将容器的不透明度设置为小于1时,显示星形评级图像,但在完全不透明度时,图像消失。是否有一种方法可以修复以下星级图像css,以便在不使用不透明度的情况下正确显示。可能与z指数有关 /* 'star-rating' component */ .starRate {position:relative; margin:20px

所以我使用了网站上的代码在我的网页上显示星级组件。早些时候,它工作正常,但当我将网页背景更改为黑色(图像),主容器背景更改为白色时,星形图像消失,我尝试修复它,发现将容器的不透明度设置为小于1时,显示星形评级图像,但在完全不透明度时,图像消失。是否有一种方法可以修复以下星级图像css,以便在不使用不透明度的情况下正确显示。可能与z指数有关

    /* 'star-rating' component */
    .starRate {position:relative; margin:20px; overflow:hidden; zoom:1;}
    .starRate ul {width:160px; margin:0; padding:0;}
    .starRate li {display:inline; list-style:none;}
    .starRate a, .starRate b {background:url(img/star_rate.gif) left top repeat-x;}
    .starRate a {float:right; margin:0 80px 0 -144px; width:80px; height:16px; background-position:left 16px; color:#000; text-decoration:none;}
    .starRate a:hover {background-position:left -32px;}
    .starRate b {position:absolute; z-index:-1; width:80px; height:16px; background-position:left -16px;}
    .starRate div b {left:0px; bottom:0px; background-position:left top;}
    .starRate a span {position:absolute; left:-300px;}
    .starRate a:hover span {left:90px; width:100%;}
这是我的网页css

    body{
        background: url('images/bg.jpg');       
    }
    .container {                
                    border: 1px solid #CECECE;
                    background-color: #fff;
                    border-radius: 6px;
                    -moz-box-shadow: 0 0 10px 5px #ccc;
                    -webkit-box-shadow: 0 0 10px 5px #ccc;
                    box-shadow: 0 0 10px 5px #ccc;
                    margin: 10px auto;
                    padding: 0 10px;
                    min-height: 660px;

                }

[EDIT}我制作了一个JSFIDLE。在输出窗口中,如果您将鼠标悬停在“当前评级为3颗星”的下方,您可以看到星星,但最初它们不可见。使用
不透明度:.999
背景:rgba(255255255,0.999)
容器上。

这是因为不透明度不是1会创建一个新的,因此会设置与容器相关的星形图像

堆叠上下文在文档中的任何位置由以下任一元素构成:

  • 根元素(HTML)
  • 使用z索引值(绝对或相对)定位,而不是
  • “自动”,不透明度值小于1的元素。(请参见
  • 移动WebKit和Chrome 22+上的不透明度规范
  • 位置:固定始终创建新的堆叠上下文,即使在
  • z索引为“自动”

容器上使用
不透明度:.999
背景:rgba(255255255,0.999)

这是因为不透明度不是1会创建一个新的,因此会设置与容器相关的星形图像

堆叠上下文在文档中的任何位置由以下任一元素构成:

  • 根元素(HTML)
  • 使用z索引值(绝对或相对)定位,而不是
  • “自动”,不透明度值小于1的元素。(请参见
  • 移动WebKit和Chrome 22+上的不透明度规范
  • 位置:固定始终创建新的堆叠上下文,即使在
  • z索引为“自动”

容器上使用
不透明度:.999
背景:rgba(255255255,0.999)

这是因为不透明度不是1会创建一个新的,因此会设置与容器相关的星形图像

堆叠上下文在文档中的任何位置由以下任一元素构成:

  • 根元素(HTML)
  • 使用z索引值(绝对或相对)定位,而不是
  • “自动”,不透明度值小于1的元素。(请参见
  • 移动WebKit和Chrome 22+上的不透明度规范
  • 位置:固定始终创建新的堆叠上下文,即使在
  • z索引为“自动”

容器上使用
不透明度:.999
背景:rgba(255255255,0.999)

这是因为不透明度不是1会创建一个新的,因此会设置与容器相关的星形图像

堆叠上下文在文档中的任何位置由以下任一元素构成:

  • 根元素(HTML)
  • 使用z索引值(绝对或相对)定位,而不是
  • “自动”,不透明度值小于1的元素。(请参见
  • 移动WebKit和Chrome 22+上的不透明度规范
  • 位置:固定始终创建新的堆叠上下文,即使在
  • z索引为“自动”

只要用下面的代码更新你的css代码即可。工作正常,请查看下面的链接

 /* 'star-rating' component */
.starRate {position:relative; margin:20px; overflow:hidden; zoom:1;z-index:100;}
.starRate ul {width:160px; margin:0; padding:0;}
.starRate li {display:inline; list-style:none;}
.starRate a, .starRate b {background:url("http://www.dillerdesign.com/css/cookbook/img/star_rate.gif") left top repeat-x;}
.starRate a {float:right; margin:0 80px 0 -144px; width:80px; height:16px; background-position:left 16px; color:#000; text-decoration:none;z-index:100;}
.starRate a:hover {background-position:left -32px;}
.starRate b {position:absolute; z-index:-1; width:80px; height:16px; background-position:left -16px;}
.starRate div b {left:0px; bottom:0px; background-position:left top;}
.starRate a span {position:absolute; left:-300px;}
.starRate a:hover span {left:90px; width:100%;}

只要用下面的代码更新你的css代码即可。工作正常,请查看下面的链接

 /* 'star-rating' component */
.starRate {position:relative; margin:20px; overflow:hidden; zoom:1;z-index:100;}
.starRate ul {width:160px; margin:0; padding:0;}
.starRate li {display:inline; list-style:none;}
.starRate a, .starRate b {background:url("http://www.dillerdesign.com/css/cookbook/img/star_rate.gif") left top repeat-x;}
.starRate a {float:right; margin:0 80px 0 -144px; width:80px; height:16px; background-position:left 16px; color:#000; text-decoration:none;z-index:100;}
.starRate a:hover {background-position:left -32px;}
.starRate b {position:absolute; z-index:-1; width:80px; height:16px; background-position:left -16px;}
.starRate div b {left:0px; bottom:0px; background-position:left top;}
.starRate a span {position:absolute; left:-300px;}
.starRate a:hover span {left:90px; width:100%;}

只要用下面的代码更新你的css代码即可。工作正常,请查看下面的链接

 /* 'star-rating' component */
.starRate {position:relative; margin:20px; overflow:hidden; zoom:1;z-index:100;}
.starRate ul {width:160px; margin:0; padding:0;}
.starRate li {display:inline; list-style:none;}
.starRate a, .starRate b {background:url("http://www.dillerdesign.com/css/cookbook/img/star_rate.gif") left top repeat-x;}
.starRate a {float:right; margin:0 80px 0 -144px; width:80px; height:16px; background-position:left 16px; color:#000; text-decoration:none;z-index:100;}
.starRate a:hover {background-position:left -32px;}
.starRate b {position:absolute; z-index:-1; width:80px; height:16px; background-position:left -16px;}
.starRate div b {left:0px; bottom:0px; background-position:left top;}
.starRate a span {position:absolute; left:-300px;}
.starRate a:hover span {left:90px; width:100%;}

只要用下面的代码更新你的css代码即可。工作正常,请查看下面的链接

 /* 'star-rating' component */
.starRate {position:relative; margin:20px; overflow:hidden; zoom:1;z-index:100;}
.starRate ul {width:160px; margin:0; padding:0;}
.starRate li {display:inline; list-style:none;}
.starRate a, .starRate b {background:url("http://www.dillerdesign.com/css/cookbook/img/star_rate.gif") left top repeat-x;}
.starRate a {float:right; margin:0 80px 0 -144px; width:80px; height:16px; background-position:left 16px; color:#000; text-decoration:none;z-index:100;}
.starRate a:hover {background-position:left -32px;}
.starRate b {position:absolute; z-index:-1; width:80px; height:16px; background-position:left -16px;}
.starRate div b {left:0px; bottom:0px; background-position:left top;}
.starRate a span {position:absolute; left:-300px;}
.starRate a:hover span {left:90px; width:100%;}


你能做一个提琴吗?还包括你的html.edited问题,用于提琴链接你需要什么?你需要从一开始就显示星星吗?是的,星星在默认情况下应该是可见的,正如@zach的回答所指出的,这发生在设置不透明度时。同样奇怪的是,如果你删除容器css的背景颜色,星星会显示为看起来很好。你能做一把小提琴吗?还包括你的html。编辑过的小提琴链接问题你需要什么?你需要从一开始就显示星星吗?是的,星星应该是可见的,默认情况下,这发生在@zach的回答指出的设置不透明度时。同样奇怪的是,如果你删除容器css的背景色,则ars看起来很好。你能做一个小提琴吗?还包括你的html。你需要什么?你需要从一开始就显示星星吗?是的,星星在默认情况下应该是可见的,正如@zach的回答所指出的,这在设置不透明度时发生。同样奇怪的是,如果你删除容器css的背景色,它就不会显示星星看起来很好。你能做一把小提琴吗?还包括你的html。为小提琴链接编辑的问题你需要什么?你需要从一开始就显示星星吗?是的,星星应该是可见的,默认情况下,这发生在@zach的回答指出的设置不透明度时。同样奇怪的是,如果你删除容器c的背景色ss,星星看起来很好。嘿,你能准确地解释你改变了什么,为什么吗?嘿,你能准确地解释你改变了什么,为什么吗?嘿,你能准确地解释你改变了什么,为什么吗?嘿,你能准确地解释你改变了什么,为什么吗?