英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论