cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <h1>Sass @mixin Pseudo Element Overlay</h1>
<div class="css-overlay">
	<div class="box">
		<img src="http://www.greggant.com/emerge/codepen/cats/cat2.jpg">

<div class="css-overlay">
	<div class="box2">
			<p>This is some text that is not being covered up by the gradient. This mixin is flexible and reusable :) Feel free to leave feedback! Thanks!</p>
              //Add this to any element, the input is optional for overlays

@mixin pseudo-overlay($overlay-object) {
	&:hover {
			&:after {
				opacity: 0;
	 &:after {
		 content: ""; 
			transition: opacity 500ms cubic-bezier(0.25, 0.1, 0.25, 1);
			background: radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%,rgba(0,0,0,0.2) 15%,rgba(0,0,0,0.86) 100%); 
			opacity: 1;
			top: 0;
			left: 0;
			bottom: 0;
			right: 0;
			position: absolute;
			z-index: 3;
			height: 100%;
			width: 100%;
	#{$overlay-object}  {
		position: relative;
		z-index: 10;

//This is just the container 
.css-overlay {
	text-align: center;
	margin-top: 20px;
	margin-bottom: 50px;
	cursor: pointer;
	width: 50%;
	position: relative;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	margin-left: auto;
	margin-right: auto;
	img {
		max-width: 100%;

//these are the elements that we want to have the hover effect from the mixin.
.box, .box2  {
	margin: 0;
	padding: 0;
	color: white;
	@include pseudo-overlay("p");

.box2 {
	height: 500px;
  background-size: cover;
	p {
		padding: 50px;

// Page styling
h1 {
	color: #fff;
	font-size: 40px;
	font-family: 'Raleway', sans-serif;
body {
	width: 100%;
	text-align: center;
	background: rgb(205,235,142);
	background: radial-gradient(ellipse at center, rgba(205,235,142,1) 43%,rgba(116,153,22,1) 100%); 
	line-height: 1.4em;
Loading ..................