有我的列表项后面有一个黑色背景,我希望它是透明的。

huangapple go评论62阅读模式
英文:

There is a black background behind my list item and I want it to be transparent

问题

li {
    text-align: center;
    font-weight: 900;
    font-size: 50px;
    color: white;
    background-color: rgba(0, 0, 0, 0);
}
ul {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
}
英文:

There is an image behind this list, how do I style the list correctly so there is no black background behind it?

<div>
  <img src="image.png">
  <ul>
    <li id="1"> 1 </li>
    <li id="2"> 2 </li>
    <li id="3"> 3 </li>
    <li id="4"> 4 </li>
  </ul>
</div>

Here are my styles:

li {
    text-align: center;
    font-weight: 900;
    font-size: 50px;
    color: white;
    background-color: rgba(0, 0, 0, 0);
}

ul {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
}

I use rgba(0,0,0,0) yet behind the text there is a black background rather than transparent.

答案1

得分: 0

检查所有父元素的样式,或在 <ul> 上设置所需的背景颜色。

英文:

Check the styles of all the parents or give a desired background color on ul

huangapple
  • 本文由 发表于 2023年2月6日 12:24:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357321.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定