Skip to content

Instantly share code, notes, and snippets.

@greghunt
Created March 1, 2018 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greghunt/aaaac2c52b03da07480ba38c72f929a7 to your computer and use it in GitHub Desktop.
Save greghunt/aaaac2c52b03da07480ba38c72f929a7 to your computer and use it in GitHub Desktop.
Control Background Brightness with CSS
.image {
width: 200px;
height: 200px;
background: no-repeat center center;
background-image: url(https://images.unsplash.com/photo-1464823063530-08f10ed1a2dd?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=f0976bd6d336e2aeb5e06dbc366515ea&auto=format&fit=crop&w=1650&q=80);
background-size: cover;
position: relative;
&:after {
content: "";
display: block;
background: rgba(255,255,255,0.5); //this is your brightness control
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment