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

时间:2017-12-28 17:36:26

标签: html css wordpress css3

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

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:info@bukdangas.lv">info@bukdangas.lv</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>

1 个答案:

答案 0 :(得分:4)

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

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

并删除opacityfilter