Skip to content

Instantly share code, notes, and snippets.

@mathben
Last active March 9, 2017 07:10
Show Gist options
  • Save mathben/28fe9904a9c7e6a52a30f0fff5ac0ac6 to your computer and use it in GitHub Desktop.
Save mathben/28fe9904a9c7e6a52a30f0fff5ac0ac6 to your computer and use it in GitHub Desktop.
Apply dark_filter to add foreground dark alpha with size of under element
​#dark_filter {
border: 1px solid #aaa; /*To show the boundaries of the element*/
}
#dark_filter:before {
position: absolute;
width: 100%;
height: 100%;
content: '';
background: rgba(0,0,0, 0.5); /*partially transparent image*/
pointer-events: none;
}
<a href="manual">
<div id="dark_filter">
<button type="button" id="btn-ldr">
<br/><br/><br/><br/>
<h1 style="background: rgba(0, 0, 0, 0.4);">Livre de règles</h1>
<div style="background: rgba(0, 0, 0, 0.7)">Règles, habilités et rituels.</div>
</button>
</div>
</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment