Lock a div in place after you have selected it - css

So I have the hover state figured out. I'd like to keep the card at it's translated stated once I click on it though. I've tried using pseudo class :focus and :active but it didn't work. Or I'm just not putting the right values in.
$('.wrapper').on('click', function() {
$(this).addClass('active');
});
.wrapper:hover {
transform: translateY(5px);
}
.wrapper:active {
transform: translateY(5px);
position: fixed;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrapper">
<div class="paper">
<img src="https://www.jbhifi.com.au/FileLibrary/ProductResources/Images/216422-M-LO.jpg">
<div class="poster">
<h2>Featured</h2>
<h1>Big Baby Swing</h1>
<p>Does he look like hes stupid. Did he drive well? No. Then is he stupid? He's a good kid that's like the devil behind a wheel. That's all you need to know about him..</p>
More
</div>
</div>
<div class="space"></div>
</div>
codepen to my question

You assign a active class on click so .wrapper.active instead of .wrapper:active should work

You missed jquery cdn and add some css following if you need to get back use toggleClass.
.wrapper.active{
transform: translateY(5px);
}
.wrapper.active div a.button{
width:auto;
font-size: 0.8rem;
background-color: #29426d;
box-shadow: none;
}
$('.wrapper').on('click', function() {
$(this).addClass('active');
// You can use here toggleClass also
});
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #2c3e50;
font-family: 'Montserrat', sans-serif;
font-size: 14px;
}
/* this centers the card in the middle of any browser */
body {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
align-content: center;
background-color: #D7D7DD;
}
/* You can rename this .wrapperCard or what ever you may have used. The important thing to notice is the z-index relative to the .papaer div in order for this to work. In the HTML document .space which contains the gradient at the bottom is out side of .paper that holds the information. */
.wrapper {
margin: 0;
padding: 0;
height: auto;
width: auto;
transition: 1s ease;
cursor: pointer;
z-index: 98;
}
.wrapper:hover{
transform: translateY(5px);
}
.wrapper.active{
transform: translateY(5px);
}
.wrapper.active div a.button{
width:auto;
font-size: 0.8rem;
background-color: #29426d;
box-shadow: none;
}
.wrapper:hover div a.button{
width:auto;
font-size: 0.8rem;
background-color: #29426d;
box-shadow: none;
}
/* This calls onto the div.paper on hover and looks for div.space, if you take a way div.space your gradient will not longer dissapear on hover. */
.wrapper:hover div.space{
transform: translateY(-7px);
z-index:-1;
}
/* This is the div that contains all of the informoation, to be noted. The div is set to a specific height of 41, it basically reaches to the bottom of the MORE button. The reason being is so I can hide the gradient which is the div space, placed all the way at the bottom with a z-index of -1. If you take out the height in div.paper you will see why I made the card a particular size, so keep that in mind when you are transfering the gradient code onto the cards for NASCA. */
.paper{
font-family: 'Titilium Web', sans-serif;
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
margin: 0 auto;
padding: 0;
max-width: 300px;
min-width: 300px;
background: white;
text-align: justify;
z-index: 99;
}
a.image{
flex: 1;
text-align: none;
font-size: none;
text-decoration: none;
color:none;
transition: none;
padding:0;
margin: 0;
height: auto;
}
a.image:hover{
color:none;
border-bottom:none;
text-align: none;
box-shadow: none;
transform: none;
}
.poster{
flex: 1;
height: auto;
}
h2{
flex: 1;
font-size: .55rem;
color: #A0A6AB;
letter-spacing: 2px;
text-transform: uppercase;
text-align: center;
font-family: $sans-serif;
font-weight: 500;
margin-bottom: 10px;
}
h1{
flex: 1;
display: flex;
justify-content: center;
margin-top:1rem;
font-weight:bolder;
letter-spacing: normal;
font-kerning: 1rem;
transition: 0.5s ease;
color: #29426d;
}
h1:hover{
transform: translateX(2px);
}
p{
flex: 1;
padding: 1rem 1rem;
color:#333333;
}
a.button{
position: relative;
display: flex;
justify-content: center;
cursor: pointer;
text-transform: uppercase;
text-decoration: none;
font-size: 0.8rem;
line-height: 20px;
letter-spacing: .06rem;
font-weight: bold;
color: white;
background: #e44d6e;
margin: 0 auto;
padding: 0.5rem 1rem;
width: auto;
transition: 1s ease;
}
/* To be noted, the top selector is set to -4px because the gradient is too strong initially, pulling it up some makes it less harsh. */
.space{
flex: 1;
position: relative;
padding: 0;
margin: 0;
left: 0;
bottom: 0;
width:100%;
height: 1rem;
background: grey;
background: -webkit-linear-gradient(#333333 -290%, transparent 100%);
background: -o-linear-gradient(#333333 -290%, transparent 100%);
background: -mox-linear-gradient(#333333 -290%, transparent 100%);
background: linear-gradient(#333333 -290%, transparent 100%);
transition: 1s ease;
z-index: -1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrapper">
<div class="paper">
<img src="https://www.jbhifi.com.au/FileLibrary/ProductResources/Images/216422-M-LO.jpg">
<div class="poster">
<h2>Featured</h2>
<h1>Big Baby Swing</h1>
<p>Does he look like hes stupid. Did he drive well? No. Then is he stupid? He's a good kid that's like the devil behind a wheel. That's all you need to know about him..</p>
More
</div>
</div>
<div class="space"></div>
</div>
</body>

Related

How do I get my images to fit into my rows and columns of my bootstrap grid?

I have searched SO for this answer and could not find something specific enough that works. I saw there were a lot of similar questions, but none that lead me to a working solution. I am sorry if this is a duplicate
I am trying to replicate the feature elements from the MySpace homepage (https://myspace.com/). I am trying to get one main feature image on the left and two smaller elements (img and video) on the right. The images should go flush against each other with each column being the same height. The grid should be responsive to the changes in size of the web broser so it stays centered, proportionate, and flush.
I am using the Bootstrap 5 grid system. I have a container with a main row. That row contains two columns. The left column is for the main image. The right column holds two more rows. The top row has an image, the bottom row has an iframe.
I have used object-fit: cover, overflow:hidden, max-width: some value, max-height: auto (and vice-versa), and all combinations of rows/cols.
I've spent hours Googling and looking up examples and YouTube videos. Everything is showing basic concepts but nothing with examples in ReactJS or that are at my lower skill level.
This feels like it should be super easy and it has been the hardest thing I've had. I have even been staring at the HTML in the devtools of the MySpace page to see if I can reverse-engineer it.
import React from "react";
import Feature from "../page/Feature";
import { IMAGES_BANDS, VIDEOS_HIGHLIGHTS } from "../../images/images";
export default function Bands() {
return (
<>
<div className="container">
<div className="row">
<Feature
IMAGES_FEATURE={IMAGES_BANDS}
IMAGE_HIGHLIGHT={IMAGES_BANDS[0].image}
VIDEO_HIGHLIGHT={VIDEOS_HIGHLIGHTS[0].video}
/>
</div>
</div>
</>
);
}
import React from "react";
import Slider from "../page/Slider";
export default function Feature(props) {
const { IMAGES_FEATURE, IMAGE_HIGHLIGHT, VIDEO_HIGHLIGHT } = props;
return (
<>
<div className="container image-fit-cover no-margin-padding">
<div className="row row-cols-2 justify-content-center row-size-feature">
<div className="col-8">
<Slider images={IMAGES_FEATURE} />
</div>
<div className="col-4">
<div className="row">
<img src={IMAGE_HIGHLIGHT} alt="band-highlight" />
</div>
<div className="row">
<iframe
src={VIDEO_HIGHLIGHT}
title="YouTube video player"
frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowFullScreen
/>
</div>
</div>
</div>
</div>
</>
);
}
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
#media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
#keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.colors-theme {
background-color: black !important;
color: white !important;
}
.btn-theme {
background-color: white;
color: #000000;
display: inline-block;
font-weight: 400;
text-align: center
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: .25rem;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
text-decoration: none
}
.btn-theme:focus,
.btn-theme:hover {
text-decoration: none;
background-color: #944dff;
color: #e0ccff;
}
.btn-theme-dark {
color: white;
background-color: black;
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: .25rem;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out
}
.btn-theme-dark:focus,
.btn-theme-dark:hover {
text-decoration: none;
color: black;
background-color: #e0f2f1;
}
.btn-link-theme {
font-weight: 400;
color: #f0e6ff;
background-color: transparent;
border-color: transparent;
text-decoration: none;
padding: 0px;
}
.btn-link-theme:hover {
color: gray;
text-decoration: underline;
background-color: transparent;
border-color: transparent
}
.navbar-search-form {
justify-content: flex-end;
}
.float-right{
float: right;
}
/*slider css*/
.slider {
position: relative;
margin-top: 10px;
margin-bottom: 20px;
display: flex;
justify-content: center;
align-items: center;
}
. right-arrow {
position: absolute;
top: 50%;
right: 5px;
font-size: 1rem;
color: black;
z-index: 10;
cursor: pointer;
user-select: none;
}
.left-arrow {
position: absolute;
top: 50%;
left: 5px;
font-size: 1rem;
color: black;
z-index: 10;
cursor: pointer;
user-select: none;
}
.slide {
opacity: 0;
transition-duration: 2s ease;
}
.slide.active {
opacity: 1;
transition-duration: 2s;
transform: scale(1.00);
}
/**/
.text-overlay-parent {
position: relative;
width: 100%;
height: 100%;
}
.text-overlay-child{
position: absolute;
top: 15%;
left: 10%;
}
.font-styles-heading{
font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.row-size-feature{
height: 360px;
}
.image-fit-cover img {
height:auto;
max-width:700px;
overflow: hidden;
object-fit: cover;
}
.image-fit-cover iframe {
height: auto;
max-width: 700px;
overflow: hidden;
object-fit: cover;
}
.no-margin-padding * {
margin: 0px;
padding: 0px;
}
img of current page

Drop down div not appearing on button hover, also z-index having no effect

I am building something in React with Styled-Components.
I am trying to have a div explaining the rules drop down when a button is hovered.
Everything is in good position, but the display: none is not disappearing when hovered.
I have had this kind of trouble every time I try to do such things, I have even copied code from previous attempts. I haven't been able to find any good rules on the web. If someone could link to a blog post or site that explains why it is the way it is, or explain to to me, that would be much appreciated.
JSX
<div className="rules-wrapper">
<button id="rules-btn">
<span role="img" aria-label="new game" className="hidden-icon">
❓
</span>
rules
</button>
<div className="rules-div">
<h2>RULES:</h2>
<p>Rule 1</p>
<p>Rule 2</p>
<p>Rule 1</p>
<p>Rule 1</p>
<p>Rule 1</p>
</div>
</div>
STYLED-COMPONENTS
button {
border: none;
background: none;
position: absolute;
width: 200px;
left: 50%;
left: 50%;
transform: translateX(-50%);
color: #555;
font-family: Lato;
font-size: 20px;
text-transform: uppercase;
cursor: pointer;
font-weight: 300;
transition: background-color 0.3s, color 0.3s;
}
.rules-wrapper {
left: 50%;
transform: translateX(-50%);
position: absolute;
display: inline-block;
}
#rules-btn {
top: 2rem;
}
#rules-btn:hover .rules-div {
display: flex;
}
.rules-div {
transform: translateX(-50%);
display: none;
position: absolute;
left: 50%;
top: 3.5rem;
width: 20rem;
transform: translateX(-50%);
background: white;
flex-direction: column;
z-index: 5;
border: 2px solid gray;
padding: 2rem;
align-items: center;
box-shadow: 5px 5px 5px gray;
}
button:hover {
font-weight: 600;
}
button:hover span {
margin-right: 20px;
}
button:focus {
outline: none;
}
span {
display: inline-block;
margin-right: 15px;
line-height: 1;
vertical-align: text-top;
transition: margin 0.3s;
}
Looks like you already tried this:
#rules-btn:hover .rules-div {
display: flex;
}
This will not work because .rules-div is not a child of #rules-btn. But it is right next to each other (siblings), therefore you can use Adjacent sibling combinator
#rules-btn:hover + .rules-div {
display: flex;
}
thanks to #95faf8e76605e973 for this:
This will not work because .rules-div is not a child of #rules-btn. But it is right next to each other (siblings), therefore you can use Adjacent sibling combinator
#rules-btn:hover + .rules-div {
display: flex;
}
for the z-index I had to add
.rules-wrapper {
z-index: 5;
}

Button CSS transition/animation hover problem

I want to create a button which changes on hover. Here you can check it: https://drive.google.com/file/d/1fIcil2Xyky8DC2NRcfZBKXCMHk9gpat2/view?usp=sharing.
Here you can see my attempt: https://codepen.io/koravski/pen/BEvKRP
body {
display: flex;
justify-content: center;
align-items: center;
background: #333;
font-family: 'Lato', sans-serif;
}
.txt {
position: absolute;
color: #fff;
}
.box {
width: 200px;
height: 50px;
background-color: red;
transition: all 1s;
}
.box:hover {
width: 50px;
height: 5px;
margin-top: 40px;
}
<div class="txt">Call to action</div>
<div class="box"></div>
The problem is that when I hover it, it starts looping. It should be on the red rectangle so it won't loop.
If you have any suggestions it will be nice.
Thanks.
It's not quite clear what effect you are after but you're changing the size so when it shrinks you're not hovering on it any more.
I'd suggest a transform instead (two actually, one for the size and another for the position).
html,
body {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: #333;
font-family: 'Lato', sans-serif;
}
.txt {
position: absolute;
color: #fff;
}
.box {
width: 200px;
height: 50px;
background-color: red;
transition: all 1s;
}
.box:hover {
transform: translateY(40px) scale(.1);
}
<div class="txt">Call to action</div>
<div class="box"></div>
There are other issues but it depends on what this actually supposed to do.
In fact, you can do this with a single div.
html,
body {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: #333;
font-family: 'Lato', sans-serif;
}
.txt {
position: relative;
color: #fff;
width: 200px;
height: 50px;
line-height: 50px;
text-align: center;
transition: all 1s;
}
.txt:before {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: red;
z-index: -1;
transition: all 1s;
}
.txt:hover:before {
transform: translateY(40px) scale(.1);
}
<div class="txt">Call to action</div>
This is happening because whenever the button shrinks, your mouse is no longer hovering over it, so the animation comes back up and hits the box (causing it to trigger once again. I'd suggest using a pseudo element -
.box::before {
background-color: red;
content: '';
position: absolute;
height: 100%;
width: 100%;
z-index: 0;
transition: all 1s;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.box:hover.box::before {
width: 50px;
height: 5px;
}
https://codepen.io/aedenmurray/pen/XQodQj
Here is an idea using background animation where you will need only one element:
body {
display: flex;
justify-content: center;
align-items: center;
font-family: 'Lato', sans-serif;
}
.txt {
color: #fff;
padding:20px 50px;
background-image:linear-gradient(red,red);
background-size:100% 100%;
background-position:bottom center;
background-repeat:no-repeat;
transition:1s;
}
.txt:hover {
background-size:20% 5%;
color:#000;
}
<div class="txt">Call to action</div>
I would wrap your .box and .txt in a container, and then when that container is hovered, do the transition. That way, your hover area isn't being resized - instead the contents are.
html, body {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: #333;
font-family: 'Lato', sans-serif;
}
.txt {
position:absolute;
color: #fff;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100px;
}
.box {
width: 200px;
height: 50px;
background-color: red;
transition: all 1s;
}
.container {
position: relative;
}
.container:hover > .box {
width: 50px;
height: 5px;
margin-top: 40px;
}
<div class="container">
<div class="txt"> Call to action</div>
<div class="box"></div>
</div>
View Updated CodePen
The trick is to apply the :hover to a surrounding element.
So you keep hovering over the element and just the included block will change.
FYI:
translate3d is used for better performance than normal translateX.
You could improve the code further. The red element could be a ::before element, and you might want to attach :focus, too for better accessibility. And maybe use a button element.
html, body {
height: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: #333;
font-family: 'Lato', sans-serif;
}
.btn {
position: relative;
}
.btn-txt {
color: #fff;
text-align: center;
vertical-align: middle;
position: relative;
padding: 20px 30px;
}
.btn-box {
background-color: red;
transition: all 1s;
position: absolute;
bottom: 0;
left: 0;
height: 100%;
width: 100%;
}
.btn:hover .btn-box {
width: 50px;
height: 5px;
transform: translate3d(50px, 0, 0);
top: auto;
}
<div class="btn">
<div class="btn-box"></div>
<div class="btn-txt">Call to action</div>
</div>

Transform only the border CSS

I'm writing a code for the chat of my stream, but i got some problems... i want to rotate only the border of the chat box without move the text or the background. how can i do this? i have already read some post but did not solve my problem. i want to do something like that chat.
i use the StreamLabs.
English is not my mother tongue; please excuse any errors on my part.
I'm a beginner at the front end and these issues are taking away my peace.
#import url(https://fonts.googleapis.com/css?family=Open+Sans:600,700);
body {
background: $background_color;
color: $text_color;
}
html, body {
height: 600%;
overflow: hidden;
transform: translate(0px, -10px);
}
#log {
font: 90;
font-family: 'Montserrat', sans-serif;
position: absolute;
bottom: 0;
left: 0;
width: 60%;
box-sizing: border-box;
overflow: hidden;
padding: 10px 16px;
padding-top: 100px;
}
#log>div {
margin-bottom: 45px;
background: rgba(255, 255, 255, 0.1);
padding: 5px 10px 10px;
animation: fadeInDown .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
-webkit-animation: fadeInDown .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards;
border-radius: 8px;
}
#log>div.deleted {
visibility: hidden;
}
.meta {
display: table;
line-height: em;
transform: translate(-20px,-30px);
border-radius: 0px 05px 05px 05px;
border: 10px solid #ffd600;
background: #ffd600;
margin-bottom: -22px;
font-weight: 800;
}
.message {
word-wrap: break-word;
display: block;
padding-left: 6px;
line-height: em;
color:white;]
}
.name {
color: Black;
font-size: em;
text-transform: initial;
font-weight: 600;
}
.colon {
display: none;
}
.badge {
float: left;
padding-left: 2px;
padding-right: 7px;
padding-top: 2px;
height: 0.8em;
}
#log .emote {
background-repeat: no-repeat;
background-position: center;
padding: 0.1em;
background-size: contain;
}
#log .emote img {
display: inline-block;
height: 1em;
opacity: 0;
vertical-align: top;
}
<!-- item will be appened to this layout -->
<div id="log" class="sl__chat__layout">
</div>
<!-- chat item -->
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Merriweather" rel="stylesheet">
<script type="text/template" id="chatlist_item">
<div data-from="{from}" data-id="{messageId}">
<span class="meta" style="color: {color}">
<span class="badges">
</span>
<span class="name">{from}</span>
</span>
<span class="message">
{message}
</span>
</div>
</script>
You can add a new element to your html and style it to look like that border, or style a pseudo element like ::before or ::after to give you that look.
.tilted-border {
margin: 10px;
background: purple;
border-radius: 10px;
width: 200px;
height: 100px;
position: relative;
padding: 0;
}
.tilted-border:after {
content: '';
display: block;
position: absolute;
top: -5px;
left: -5px;
width: 100%;
height: 100%;
border: 5px solid red;
border-radius: 10px;
transform: rotate( 5deg);
pointer-events: none;
}
<div class="tilted-border"></div>
What you're trying to do is not possible. You cannot move the border of a div independently of the div and its content.
What you'll need to do is create bother div within the first div. Set the container div to position: relative and then absolutely position the new inner div to the edges of the container like so: position: absolute; top: 0; bottom: 0; left: 0; right: 0;. Then you can animate the border of the inner div while the content still sits within the container div free of the transform.

Thumbnail hover scaling within thumbnail size

I am trying to get a scale effect when I hover over a thumb, as in this Codepen example (first thumb, the Lily effect):
http://codepen.io/intermedion/pen/BQVJEx
I modified the above example to remove the figure/figcaption, and I used a flexbox layout for the thumb grid, see this pen:
http://codepen.io/intermedion/pen/dOKrWQ?editors=1100
<!-- HTML -->
<div class="wrap">
<div class="row">
<div>
<a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-1.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-1.jpg">
</a>
</div>
<div>
<a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-3.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-3.jpg">
</a>
</div>
</div>
</div>
/* CSS */
.row {
display: flex;
flex-flow: row wrap;
padding: 0 5px;
font-size: 0;
}
.row div {
flex: auto;
width: 160px;
margin: 6px 12px;
}
.row div img {
width: 100%;
height: auto;
}
/*** EFFECTS ***/
.row img {
position: relative;
display: block;
min-height: 100%;
max-width: 100%;
}
.row img {
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
}
.row:hover img {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transform: scale(1.15);
transform: scale(1.15);
}
I tried various options, including setting sizes on the thumbs, adding figure/figcaption - the thumbs scale, but over and beyond the thumbnail size, which is not what I want.
I am starting to suspect that it may be the flexbox layout that is causing the scaling beyond the rendered thumb size, but I am not sure.
Is there any way to do the scaling within the rendered thumb with a flexbox layout?
I think you forgot overflow:hidden for the div:
.row div {
flex: auto;
width: 160px;
margin: 6px 12px;
overflow: hidden;
}
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
ul {
list-style-type: none;
}
a:link { text-decoration: none; }
a:visited { text-decoration: none; }
a:hover { text-decoration: none;}
html {
background: #2b303b;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/*** LAYOUT ***/
.wrap {
max-width: 660px;
margin: 1.5em auto 1em auto;
padding: 10px 10px;
background: #2e333f;
background-color: rgba(32, 38, 52, 0.6);
background: #242B3A;
font-family: "PT Sans", "Helvetica Neue", Arial, sans-serif;
font-size: 100%;
color: rgba(127, 133, 147, 0.8);
border-radius: 5px;
-webkit-border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
}
/*** GRID ***/
.row {
display: flex;
flex-flow: row wrap;
padding: 0 5px;
font-size: 0;
}
.row div {
flex: auto;
width: 160px;
margin: 6px 12px;
overflow: hidden;
}
.row div img {
width: 100%;
height: auto;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
/*** EFFECTS ***/
.row img {
position: relative;
display: block;
min-height: 100%;
max-width: 100%;
}
.row img {
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
}
.row div:hover img {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transform: scale(1.15);
transform: scale(1.15);
}
/*** CAPTIONS ***/
/*
.grid figure {
position: relative;
float: left;
overflow: hidden;
margin: 10px 1%;
min-width: 300px;
max-width: 480px;
max-height: 360px;
width: 48%;
background: #3085a3;
text-align: center;
cursor: pointer;
}
*/
/*
.grid figure img {
position: relative;
display: block;
min-height: 100%;
max-width: 100%;
opacity: 0.8;
}
*/
<div class="wrap">
<div class="row">
<div>
<a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-1.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-1.jpg">
</a>
</div>
<div>
<a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-3.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/jeremiah-wilson-3.jpg">
</a>
</div>
</div>
</div>

Resources