2017-10-04 6 views
0

のための無不透明度:背景に不透明度が、私はこのようになります私のウェブサイト上でこの写真を持っているテキスト

enter image description here

今、私は私はそれをどのように行うか、テキストは不透明度を持つようにしたくないですか?

.hero_content h1 { 
 
    color: #011f4b; 
 
    font-weight: 700; 
 
    font-size: 45px; 
 
} 
 

 
.hero_content h2 { 
 
    color: #000; 
 
    font-weight: 700; 
 
    font-size: 20px; 
 
    margin-top: 0; 
 
    width: 50%; 
 
    line-height: 1px; 
 
} 
 

 
div.transbox { 
 
    padding-bottom: 20px; 
 
    padding-top: 1px; 
 
    padding-left: 100px; 
 
    background-color: #ffffff; 
 
    border: 0px solid black; 
 
    opacity: 0.3; 
 
    margin-top: 170px; 
 
    margin-left: -110px; 
 
    width: 1360px; 
 
}
<div class="transbox"> 
 
    <h1>TeamSpan Global Solutions</h1> 
 
    <h2>Your partner in building satellite workforce teams</h2> 
 
</div>

+1

のような擬似クラスを使用してください。 'rg背景色は「ba」です。 – Xufox

+1

トランスボックスから不透明度を削除する – krishnar

+0

@krishnarそれから、ボックスの不透明度が削除されます。ボックスの不透明度を維持しますが、テキストは残さないようにします。 –

答えて

0

NVM、それを考え出しました。 transboxの

背景色は次のようになります。

background-color: rgba(255, 255, 255, 0.3);

1

あなたが含むdivためopacityを使用している場合は、それはそれの子供たちのすべてに影響します。 、何らかの理由であなたがdivを封入するための不透明度を使用する必要がある場合 color:rgb(0,0,0);

: あなたは、具体的囲んdivをターゲットにする必要があり、したがって、このようrgbaの形式を使用します。

background-color: rgba(255, 255, 255, 0.6); 

内側h2用子どもに影響を与えないようにするには、

.transbox:after{ 
    content:""; 
    position:absolute; 
    width:600px; 
    height:600px; 
    opacity:0.3; 
    top:0; 
    left:0; 
    background-color:white; 
} 
関連する問題