Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
amadeo brands
15,375 PointsAdding opacity to the background different then child div
Adding opacity to the background different then child div ... ITs not working ...
HTML
<div class="header-block">
<div class="col-md-4 block-fate" style="background-image: url(<?php the_field('background_img01'); ?>)">
<a href="#">
<div class="inner-background">
<div class="clear">
<img src="<?php the_field('illustration01'); ?>" class="inner-ilustration" />
</div>
</div>
<div class="inner-text">
<h2><?php the_field('text01'); ?></h2>
</div>
</a>
</div>
CSS
/*--------------------------------------------------------------
above folt header
--------------------------------------------------------------*/
.header-block .col-md-4 { padding: 0; height: 500px; background-size: cover; background-repeat: no-repeat; background-position: center center; }
.inner-ilustration, .inner-text { margin: 0 auto 0 auto; }
.inner-background { background: #292b53; width: 90%; max-width: 290px; opacity: 0.3; text-align: center; width: 90%; max-width: 290px; padding: 20px; margin-top: 98px; margin-left: auto; margin-right: auto; z-index: -100 !important; }
.inner-background img{ opacity: 0,9 !important; z-index: 100 !important; }
.inner-text { background: #292b53; text-align: center; width: 90%; max-width: 290px; text-decoration: none; opacity: 0.9; }
.inner-text h2 { margin: 0; padding: 20px 0 20px 0; font-size: 20px; text-transform: uppercase; line-height: 1.4; }
.header-block a { text-decoration: none; color: #ffffff; }
5 Answers
Riku S.
11,322 PointsYour inner-background img opacity is set with comma, it should be with period.
.inner-background img {
opacity: 0.9 !important;
z-index: 100 !important;
}
amadeo brands
15,375 PointsThank you rick ... I already try that but not working unfortunately. Thank you.
Riku S.
11,322 PointsI just tried your code with changing "0,9" to "0.9" and seems to work just fine here.
Hannah Carpenter
8,650 PointsTry using rgba color values instead of hex codes and opacity.
David Perkins
9,607 PointsI don't know if you've managed to sort this yet, but how about something like this?