css - How to apply a background to a DIV, but keep child image background transparent -


I want a developer in my heading with a focused image and a background color, but I want to have background color Do not want to show through the image.

html:

  & lt; Div id = "header" & gt; & Lt; A href = "home.html" & gt; & Lt; Img id = "headerpic" src = "picture / logo.png" & gt; & Lt; / A & gt; & Lt; / Div & gt;  

CSS:

  #header {opacity: 0.5; Width: 100%; Height: 150px; Margin-down: 50px; Background-color: # 000; } #headerpic {height: 100%; Display area; Margin-left: auto; Margin-right: auto; Background color: none; }  

Please help D:

do not div div to any opacity , Which will be inherited by the hair elements. Instead of defining its background color "opaque" effect for child elements in RGBA palette.That way is defined

Edit:. In your case it will look like this:

  # header {background color: RGBA (0,0,0,0,5.5); }  

You can see, when you have inherited below ambiguity, define color and opacity (thats in RGBA, it stands for alpha), but it only The specified selector has applied for the Dom Tree.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -