透明背景也使我的文字透明

问题描述 投票:0回答:1

我正在制作一个黑色透明背景的文本框,我希望文本不透明,但它也使我的文本透明。有人能告诉我哪里弄错了吗?

style.css文件

#headertxt  {
position: absolute;
right: 20px;
bottom: 100px;
background-size: auto;
background: black;
 padding: 10px 10px 10px 10px;
 opacity: 0.7;
 filter: alpha(opacity=70); 
 }

 #headertxt a {
text-align: right;
color: white;
}

HTML:

   <div id="headertxt">
    <a>Zvani <span class="head"> (+371) 29 256 487</span><br /></a>
     <a>  Raksti <span class="head"><ahref="mailto:[email protected]">[email protected]</a></span><br /></a>
     <a>Redzi mūs <span class="head"><a href="/ka-mus-atrast/">kartē</a>
      <br/></a>
        <a><span class="head">N 57° 11' 22" E 22° 12' 46"</span><br />  </a>
                    <hr>
                    <a>REKVIZĪTI</a>
                            </div>
html css wordpress css3
1个回答
4
投票

opacityfilter适用于整个元素。您需要切换到rgba格式作为背景。它应该是:

background: rgba(0, 0, 0, 0.7);

并摆脱opacityfilter

© www.soinside.com 2019 - 2024. All rights reserved.