What I want to do is have a div
with a transparent background that doesn't affect the text. Consider the following HTML:
<section class="content">
<header>
<h1>Description</h1>
</header>
Code
</section>
If I were to give it the following CSS:
background-color: #7ac0da;
opacity: 0.5;
filter: alpha(opacity=50);
The text would suffer from the transparency of the section
. So, I started trying to layer the content like this:
<div class="code-sample">
<div class="background"></div>
<section class="content">
<header>
<h1>Description</h1>
</header>
Code
</section>
</div>
However, with an enumerable number of iterations I'm unable to get the section
to layer over the div
. I'll be honest, I've tried positioning the inner div
and section
absolute and relative. I've tried using the z-index
. But really, I'm just shooting in the dark here. I'd like the .background
to have a transparent look:
background-color: #7ac0da;
opacity: 0.5;
filter: alpha(opacity=50);
but yet the .content
then overlay that div
. This will allow me to then float the .code-sample
div and do like a three-column layout with those.
How can I achieve what I'm looking for?