Skip to content

Instantly share code, notes, and snippets.

@itwasmattgregg
Last active August 30, 2016 16:34
Show Gist options
  • Save itwasmattgregg/6d985fc89935ae76f37689e0b900cb3b to your computer and use it in GitHub Desktop.
Save itwasmattgregg/6d985fc89935ae76f37689e0b900cb3b to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="image">
<img src="https://www.yatzer.com/sites/default/files/media/slideshow/f5_out_my_window_gail_albert_halaban_new_york_glasshousewithdog_yatzer.jpg" />
<div class="caption">
A nice caption for out image
<br>
<button class="btn">Action Item</button>
</div>
</div>
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
body {
background-color: #ddd;
font-family: helvetica;
}
.image {
margin-top: 30px;
width: 400px;
position: relative;
&:before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 15px;
z-index: 2;
border: 1px solid #fff;
border-bottom: none;
pointer-events: none;
opacity: 0;
-moz-transform: scale(1,1);
-ms-transform: scale(1,1);
-webkit-transform: scale(1,1);
transform: scale(1,1);
-moz-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
&:hover:before {
opacity: 1;
top: 10px;
left: 10px;
right: 10px;
}
img {
max-width: 100%;
position: relative;
}
.caption {
width: 100%;
background-color: #fff;
display: block;
margin-top: -3px;
padding: 13px;
box-sizing: border-box;
.btn {
border: 1px solid #ddd;
background-color: #fff;
padding: 5px 10px;
margin-top: 15px;
}
}
}
body {
background-color: #ddd;
font-family: helvetica;
}
.image {
margin-top: 30px;
width: 400px;
position: relative;
}
.image:before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 15px;
z-index: 2;
border: 1px solid #fff;
border-bottom: none;
pointer-events: none;
opacity: 0;
-moz-transform: scale(1, 1);
-ms-transform: scale(1, 1);
-webkit-transform: scale(1, 1);
transform: scale(1, 1);
-moz-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.image:hover:before {
opacity: 1;
top: 10px;
left: 10px;
right: 10px;
}
.image img {
max-width: 100%;
position: relative;
}
.image .caption {
width: 100%;
background-color: #fff;
display: block;
margin-top: -3px;
padding: 13px;
box-sizing: border-box;
}
.image .caption .btn {
border: 1px solid #ddd;
background-color: #fff;
padding: 5px 10px;
margin-top: 15px;
}
<div class="image">
<img src="https://www.yatzer.com/sites/default/files/media/slideshow/f5_out_my_window_gail_albert_halaban_new_york_glasshousewithdog_yatzer.jpg" />
<div class="caption">
A nice caption for out image
<br>
<button class="btn">Action Item</button>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment