1175 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
mabuc says

Hello guys,

I have a simple problem.. how can I make the background image opacity that does not affect the child element.. below are my code on this..

CSS
.menu ul li.nav-home { background:url('img/icons/home.png') no-repeat center 6px; opacity:0.2; }
HTML
<div class="menu">
<ul>
<li class="nav-home"><a href="#">Home</a></li>
</ul>  
</div> 

this is wp_nav_menu for WordPress.. I google this but still not working maybe you have an idea..

thanks

242 posts
  • Europe
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
creativestuff says

have you tried

.menu ul li.nav-home { background:url(‘img/icons/home.png’) no-repeat center 6px; opacity:0.2; }

+

.menu ul li.nav-home a{ opacity:1; }

1175 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
mabuc says

have you tried

.menu ul li.nav-home { background:url(‘img/icons/home.png’) no-repeat center 6px; opacity:0.2; }

+

.menu ul li.nav-home a{ opacity:1; }

Yes.. that will not work..

1034 posts
  • Microlancer Beta Tester
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • United Kingdom
  • Has been a member for 2-3 years
BenSheppard says

Yeah, it won’t work as everything in the <ui> becomes opacity 0.2



use rgba eg, (255, 255, 255, 0.6) will be like opacity 0.6 on a white background. This changes the color and not the actual transparency, this doesn’t work in IE7 but there is a fix online! :)

1175 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
mabuc says

This is not working also.. Seems I cannot solve this one.. here’s my new question.. How do I add extra span tag in my wp_nav_menu function?

<div class="menu">
<ul>
<li class="nav-home"><span> </span><a href="#">Home</a></li>
</ul>  
</div> 
by
by
by
by
by
by