Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solid div inside transparent div?

Tags:

css

opacity

I have a navigation list (unordered list) inside of a div with an opacity of .4. The anchors inside the UL are set to opacity 1, but this has no effect.

<div style="background-color: #000; opacity: 0.4">
    <ul>
        <li><a href=".." style="background-color: #000; opacity: 1">home</a></li>
    </ul>
</div>

Any suggestions? Thanks

like image 252
aserwin Avatar asked Apr 12 '13 20:04

aserwin


1 Answers

Try it like this

<div style="background-color: rgba(0, 0, 0, .4);">
    <ul>
        <li><a href=".." style="background-color: rgba(0, 0, 0, 1);">home</a></li>
    </ul>
</div>

And it's a good idea to avoid inline styles.

like image 101
Zoltan Toth Avatar answered Sep 28 '22 00:09

Zoltan Toth