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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

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 ..................