Delay Hover Effect - prevent switching off overlay - html

I created a hover effect that is blurring out a picture and a text-description appears.
Now as soon as I hover above the description, I dont hover the image and the effect is failing, which I would like to prevent.
I assume that if I could target the hovered - version of the description, I could make it set sort of itself to be visible, but I am not sure about this.
Any other ideas how I can create this?
.flexbox{
position: relative;
display: flex;
height: 70vh;
flex-direction: row;
width: 90%;
margin-left: 5%;
max-height: 80vh;
}
.container{
width: 100%;
max-height: inherit;
padding: 0;
margin: 1%;
display:block;
text-align: center;
}
.image-category{
width: 100%;
object-fit: cover;
height: 100%;
opacity: 0.95;
max-height: inherit;
overflow: hidden;
}
.image-description{
padding: 10px;
transform: translateY(-30vh);
opacity: 0;
z-index: -1;
font-size: 20px;
}
.image-category:hover{
filter: blur(2px);
}
.image-category:hover ~ .image-description{
opacity: 100;
z-index: 2;
}
.description{
font-size: 1.25em;
background: rgba(255, 255, 255, 0.7);
}
.claim{
padding: 1vh 0 1vh 0;
width: 100%;
text-align: center;
}
Delay Hover
<div class="flexbox" id="flex">
<div class="container" id="box1">
<a class="image-category" href="https://amh-solingen.de/scheren.html">
<img class="image-category" id="product3" src="/images/Schere.jpg">
</a>
<div class="image-description">
<p class="description">Haushalts- und Friseurscheren</p>
</div>
</div>
<div class="container" id="box2">
<a class="image-category" href="https://amh-solingen.de/haushaltsmesser.html">
<img class="image-category" id="product2" src="/images/Hero.png">
</a>
<div class="image-description">
<p class="description">Aktuelle Auswahl an Küchenmessern</p>
</div>
</div>
<div class="container" id="box3">
<a class="image-category" href="https://amh-solingen.de/klingen.html">
<img class="image-category" id="product3" src="/images/Klinge_7.jpg">
</a>
<div class="image-description">
<p class="description">Klingen für Haushaltsmesser</p>
</div>
</div>
</div>

use this code:
.flexbox{
position: relative;
display: flex;
height: 70vh;
flex-direction: row;
width: 90%;
margin-left: 5%;
max-height: 80vh;
}
.container{
width: 100%;
max-height: inherit;
padding: 0;
margin: 1%;
display:block;
text-align: center;
}
.image-category{
width: 100%;
object-fit: cover;
height: 100%;
opacity: 0.95;
max-height: inherit;
overflow: hidden;
}
.image-description{
padding: 10px;
transform: translateY(-30vh);
opacity: 0;
z-index: -1;
font-size: 20px;
}
.container:hover .image-category{
filter: blur(2px);
}
.container:hover .image-description{
opacity: 100;
z-index: 2;
}
.description{
font-size: 1.25em;
background: rgba(255, 255, 255, 0.7);
}
.claim{
padding: 1vh 0 1vh 0;
width: 100%;
text-align: center;
}
Delay Hover
<div class="flexbox" id="flex">
<div class="container" id="box1">
<a class="image-category" href="https://amh-solingen.de/scheren.html">
<img class="image-category" id="product3" src="/images/Schere.jpg">
</a>
<div class="image-description">
<p class="description">Haushalts- und Friseurscheren</p>
</div>
</div>
<div class="container" id="box2">
<a class="image-category" href="https://amh-solingen.de/haushaltsmesser.html">
<img class="image-category" id="product2" src="/images/Hero.png">
</a>
<div class="image-description">
<p class="description">Aktuelle Auswahl an Küchenmessern</p>
</div>
</div>
<div class="container" id="box3">
<a class="image-category" href="https://amh-solingen.de/klingen.html">
<img class="image-category" id="product3" src="/images/Klinge_7.jpg">
</a>
<div class="image-description">
<p class="description">Klingen für Haushaltsmesser</p>
</div>
</div>
</div>

Related

positioning a div in above another div

This is challenging for me to position the share div like in the picture above. well, I tried the position absolute with bottom and left it's so frustrating adjusting the px but the output is always either stacked on top or bottom. how can I achieve that similar output in the picture?
:root {
--VeryDarkGrayishBlue: hsl(217, 19%, 35%);
--DesaturatedDarkBlue: hsl(214, 17%, 51%);
--GrayishBlue: hsl(212, 23%, 69%);
--LightGrayishBlue: hsl(210, 46%, 95%);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Manrope", sans-serif;
}
body {
background-color: var(--GrayishBlue);
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 20px;
}
.container {
display: grid;
grid-template-columns: 2fr 3fr;
max-width: 1150px;
max-height: 390px;
margin: auto;
background-color: white;
overflow: hidden;
border-radius: 0.8em;
}
.img-box {}
.img-box img {
width: 100%;
height: 100%;
object-fit: cover;
}
.text-box {
padding: 8%;
}
.text {
padding-bottom: 30px;
}
.title {
color: var(--VeryDarkGrayishBlue);
padding-bottom: 10px;
}
.subtitle {
color: var(--GrayishBlue);
font-size: 1.1em;
}
.writer img {
width: 50px;
height: 50px;
border-radius: 50%;
}
.footer {
display: flex;
flex-direction: row;
align-items: center;
}
.name {
margin-left: 12px;
}
.name h4 {
color: var(--VeryDarkGrayishBlue);
}
.name p {
color: var(--GrayishBlue);
}
.share {
margin-left: auto;
}
.share-icon button {
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: var(--LightGrayishBlue);
cursor: pointer;
}
.share-option {
width: 250px;
height: 40px;
background: var(--VeryDarkGrayishBlue);
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: white;
position: absolute;
bottom: ;
}
<main class="container">
<div class="img-box">
<img src="/images/drawers.jpg" alt="" />
</div>
<div class="text-box">
<div class="text">
<h1 class="title">
Shift the overall look and feel by adding these wonderful touches to furniture in your home
</h1>
<p class="subtitle">
Ever been in a room and felt like something was missing? Perhaps it felt slightly bare and uninviting. I’ve got some simple tips to help you make any room feel complete.
</p>
</div>
<div class="footer">
<div class="writer">
<img src="/images/avatar-michelle.jpg" alt="" />
</div>
<div class="name">
<h4>Michelle Appleton</h4>
<p>28 Jun 2020</p>
</div>
<div class="share">
<div class="share-icon">
<button><img src="/images/icon-share.svg" alt=""></button>
</div>
<div class="share-option hidden">
<span>Share</span>
<a href="#"> <img src="/images/icon-facebook.svg" alt=""> <a/>
<a href="#"> <img src="/images/icon-pinterest.svg" alt=""> <a/>
<a href="#"> <img src="/images/icon-twitter.svg" alt=""> <a/>
</div>
</div>
</div>
</div>
</main>
I have made some changes in the code and made the popup visible with absolute.
:root {
--VeryDarkGrayishBlue: hsl(217, 19%, 35%);
--DesaturatedDarkBlue: hsl(214, 17%, 51%);
--GrayishBlue: hsl(212, 23%, 69%);
--LightGrayishBlue: hsl(210, 46%, 95%);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Manrope", sans-serif;
}
body {
background-color: var(--GrayishBlue);
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 20px;
}
.container {
display: grid;
grid-template-columns: 2fr 3fr;
max-width: 1150px;
max-height: 390px;
margin: auto;
background-color: white;
border-radius: 0.8em;
}
.container:after {
display: block;
content: '';
clear: both;
}
.img-box {}
.img-box img {
width: 100%;
height: 100%;
object-fit: cover;
}
.text-box {
padding: 8%;
}
.text {
padding-bottom: 30px;
}
.title {
color: var(--VeryDarkGrayishBlue);
padding-bottom: 10px;
}
.subtitle {
color: var(--GrayishBlue);
font-size: 1.1em;
}
.writer img {
width: 50px;
height: 50px;
border-radius: 50%;
}
.footer {
display: flex;
flex-direction: row;
align-items: center;
}
.name {
margin-left: 12px;
}
.name h4 {
color: var(--VeryDarkGrayishBlue);
}
.name p {
color: var(--GrayishBlue);
}
.share {
margin-left: auto;
position: relative;
padding: 20px 0 0;
}
.share-icon button {
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: var(--LightGrayishBlue);
cursor: pointer;
}
.share-option {
width: 250px;
height: 40px;
background: var(--VeryDarkGrayishBlue);
border-radius: 10px;
color: white;
position: absolute;
bottom: 100%;
right: 50%;
transform: translatex(50%);
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.5s linear;
}
.share-option:after {
top: 100%;
left: 50%;
border: solid transparent;
content: "";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(136, 183, 213, 0);
border-top-color: var(--VeryDarkGrayishBlue);
border-width: 10px;
margin-left: -10px;
}
.share:hover .share-option {
visibility: visible;
opacity: 1;
}
<main class="container">
<div class="img-box">
<img src="/images/drawers.jpg" alt="" />
</div>
<div class="text-box">
<div class="text">
<h1 class="title">
Shift the overall look and feel by adding these wonderful touches to furniture in your home
</h1>
<p class="subtitle">
Ever been in a room and felt like something was missing? Perhaps it felt slightly bare and uninviting. I’ve got some simple tips to help you make any room feel complete.
</p>
</div>
<div class="footer">
<div class="writer">
<img src="/images/avatar-michelle.jpg" alt="" />
</div>
<div class="name">
<h4>Michelle Appleton</h4>
<p>28 Jun 2020</p>
</div>
<div class="share">
<div class="share-icon">
<button><img src="/images/icon-share.svg" alt=""></button>
</div>
<div class="share-option hidden">
<span>Share</span>
<a href="#"> <img src="/images/icon-facebook.svg" alt=""> <a/>
<a href="#"> <img src="/images/icon-pinterest.svg" alt=""> <a/>
<a href="#"> <img src="/images/icon-twitter.svg" alt=""> <a/>
</div>
</div>
</div>
</div>
</main>
I think without javascript you won't be able to do it.
You could include your share-option (position absolute) inside share-icon (position relative). This way option would be positioned relative to the button.
<div class="share">
<div class="share-icon">
<button>
<img src="/images/icon-share.svg" alt="">
</button>
<div class="share-option hidden">
<span>Share</span>
<img src="/images/icon-facebook.svg" alt="">
<img src="/images/icon-pinterest.svg" alt="">
<img src="/images/icon-twitter.svg" alt="">
</div>
</div>
</div>
and css
.share-icon {
position: relative;
}
.share-icon button {
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: var(--LightGrayishBlue);
cursor: pointer;
}
.share-option {
width: 250px;
height: 40px;
background: var(--VeryDarkGrayishBlue);
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: white;
position: absolute;
top: -40px;
z-index: 100;
}
Now the problem is options are in the boundary of the relative, so it doesn't extend on the right!
I suppose this container is responsive, meaning size can change. So I think the only way would be to put the option in the body (display none), when a click (or hover) happens on the button, you take the position of the button and position options on top of it with display flex

How do I make my image insert in the circle and get centered in the .s-circles-1

How do I make my image gets centered in the .s-circles-1 <div>...
Html
.s-circles-1 {
display: inline-block;
opacity: 0.1;
margin-left: 315px;
margin-top: 155px;
background-color: #fff;
width: 164px;
height: 164px;
border-radius: 100%;
position: relative;
}
.s-img-1 {
opacity: 0.9;
display: inline-block;
position: absolute;
color: #E37218;
margin-right: 70vw;
width: 120px;
height: 120px;
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="s-circles-1">
<img src="/Shapes/code (1).svg" alt="" class="s-img-1">
</div>
</div>
I am trying to make my image get inserted in the circle.
Thanks in advance.
With background-image :
div.circle {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
border-radius: 100%;
width: 164px;
aspect-ratio : 1 / 1;
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="circle" style="background-image: url(https://thispersondoesnotexist.com/image)"></div>
</div>
With your code, you need to change your css with this (if you don't want to use background-image) :
s-circles-1 class : set overflow:hidden;
s-img-1 class : set
width:100%; and height:100%;
.s-circles-1 {
display: inline-block;
opacity: 0.5;
width: 164px;
aspect-ratio:1 / 1; /* Keep the same width */
border-radius: 100%;
overflow: hidden;
}
.s-circles-1 img {
opacity: 0.9;
width: 100%;
height: 100%;
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="s-circles-1">
<img src="https://thispersondoesnotexist.com/image" alt="">
</div>
</div>
With your code, but if your image is not a square :
div.circle {
display: flex;
justify-content: center;
align-items: center;
border-radius: 100%;
width: 164px;
aspect-ratio : 1 / 1;
overflow: hidden;
}
div.circle img {
/*if width > height*/
height: 164px;
/*if height > width*/
/*width: 164px;*/
}
<div class="services">
<div class="s-text">
<h2>Services</h2>
</div>
<div class="circle">
<img src="https://dummyimage.com/1200x500/000/fff" alt="" class="circle">
</div>
</div>

Content won't overflow even with CSS property

I'm having trouble to make the content scroll in smaller viewport even with overflow property. My goal is to maintain the size of each image box and with the ability to scroll horizontally when the viewport is minimized.
.block-content {
width: 100%;
height: 100%;
}
.block-content .even-content {
display: flex;
position: relative;
width: 100%;
margin: 0 auto;
overflow: auto;
white-space: nowrap;
}
.even-content>* {
flex: 1;
}
.container {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
}
.image {
width: 100%;
height: 100%;
transition: all .5s ease;
object-fit: cover;
object-position: center;
}
.card-text {
padding: 3.75rem;
position: absolute;
z-index: 1;
left: 0;
bottom: 0;
}
.card-text h3 {
color: white;
margin-bottom: 2rem;
font-size: 2.25rem;
}
.card-text .fa-arrow-right {
margin-right: 10px;
}
.container:hover .image {
transform: scale(1.03);
}
<section class="block-content">
<div class="even-content scroll-menu">
<div class="container">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_04_900x.png?v=1663942261 alt=" " class="image ">
<div class="card-text ">
<h3>Pack Heavy <br><i class="fa-solid fa-arrow-right "></i>Chase Light</h3>
<button class="button ">Watch Now</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_us_au_mid_august_04_900x.png?v=1660903200 " alt=" " class="image ">
<div class="card-text ">
<h3>Midnight Sun</h3>
<button class="button ">Shop</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_05_ecfb361d-bd54-4d01-b9f1-0669bfd82552_900x.png?v=1663943416 " alt=" " class="image ">
<div class="card-text ">
<h3>SS22</h3>
<button class="button ">Shop</button>
</div>
</div>
</div>
</section>
Return to post
Your issue comes from this block:
.even-content>* {
flex: 1;
}
flex is a shorthand for the following CSS properties:
flex-grow
flex-shrink
flex-basis
Those blocks are similar:
.even-content>* {
flex: 1;
}
.even-content>* {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0%;
}
So, what is happening?
flex-shrink
The flex-shrink CSS property sets the flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items shrink to fit according to flex-shrink.
flex-shrink - MDN
You're telling your .even-content>* that they should shrink without having a minimum width.
What can you do?
You can add a flex-basis with the minimum width you're willing to have and change your flex-shrink property to 0.
.even-content>* {
flex: 1 0 320px;
}
Full code:
.block-content {
width: 100%;
height: 100%;
}
.block-content .even-content {
display: flex;
position: relative;
width: 100%;
margin: 0 auto;
overflow: auto;
white-space: nowrap;
}
.even-content>* {
flex: 1 0 320px;
}
.container {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
}
.image {
width: 100%;
height: 100%;
transition: all .5s ease;
object-fit: cover;
object-position: center;
}
.card-text {
padding: 3.75rem;
position: absolute;
z-index: 1;
left: 0;
bottom: 0;
}
.card-text h3 {
color: white;
margin-bottom: 2rem;
font-size: 2.25rem;
}
.card-text .fa-arrow-right {
margin-right: 10px;
}
.container:hover .image {
transform: scale(1.03);
}
<section class="block-content">
<div class="even-content scroll-menu">
<div class="container">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_04_900x.png?v=1663942261" alt=" " class="image ">
<div class="card-text ">
<h3>Pack Heavy <br>
<i class="fa-solid fa-arrow-right "></i>Chase Light
</h3>
<button class="button ">Watch Now</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_us_au_mid_august_04_900x.png?v=1660903200
" alt=" " class="image ">
<div class="card-text ">
<h3>Midnight Sun</h3>
<button class="button ">Shop</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_05_ecfb361d-bd54-4d01-b9f1-0669bfd82552_900x.png?v=1663943416
" alt=" " class="image ">
<div class="card-text ">
<h3>SS22</h3>
<button class="button ">Shop</button>
</div>
</div>
</div>
</section>
Return to post

How can I fix images in flexbox to wrap 2x2? And correct the hover option?

These are my two flexboxes, one for text and the other for category links. I'm trying to lay the category pictures as 2 by 2. I tried to use row wrap, and center the contents, but it didn't work. I also used various methods using containers, but it always ends up 1 x 4... Also, I'm trying to hover option to fit perfectly into the image, but somehow I have the hover background image not perfectly fit with the image although it's height and width is set to 100%.
How can I solve these issues?
.flex-container {
display: flex;
justify-content: center;
flex-direction: row;
width: 800px;
}
.flex-container > div {
margin: 10px;
padding: 20px;
font-size: 20px;
text-align: center;
flex-flow: row wrap;
}
.one {
flex: 1 1 auto;
}
.two {
flex: 1 1 auto;
}
div.two a > img {
padding: 10px;
margin: 10px;
}
a {
text-decoration: none;
}
h1 {
display: block;
font-size: 1.3em;
margin: 0.67em 0;
font-weight: bold;
}
h2 {
display: block;
font-size: 0.8em;
margin: 0.83em 0;
font-weight: bold;
}
.container {
position: relative;
width: 50%;
}
.image {
display: block;
width: 200%;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: darkorchid;
}
.container:hover .overlay {
opacity: 1;
}
.text {
color: Black;
font-size: 18px;
position: absolute;
top: 30%;
left: 100%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
<section>
<div class="flex-container">
<div class="one"> <h1> Welcome to Delicious Book store, <br>
where you can find so many delicious food!</h1>
<p> As a specialized book store, we have many cooking books on
holiday specials, vegetarian, desserts and cultural cuisines!</p>
</div>
<div class="two"> <h2> Shop By Category </h2>
<div class="container">
<a href="category.html">
<img src="images/categories/holiday.jpg" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Holiday</div>
</div></a>
</div>
<div class="container">
<a href="category.html">
<img src="images/categories/holiday.jpg" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Dessert</div>
</div></a>
</div>
<div class="container">
<a href="category.html">
<img src="images/categories/holiday.jpg" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Vegetarian</div>
</div></a>
</div>
<div class="container">
<a href="category.html">
<img src="images/categories/holiday.jpg" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Cultural Cuisine</div>
</div></a>
</div>
</div>
</div>
</section>
I've wrapped your boxes with flex container, and change some css regards width of the boxes and their content. Also added width: 100% to your .flex-container.
.flex-container {
display: flex;
justify-content: center;
flex-direction: row;
width: 100%;
}
.flex-container > div {
margin: 10px;
padding: 20px;
font-size: 20px;
text-align: center;
flex-flow: row wrap;
width: 500%;
}
.one {
flex: 1 1 auto;
}
.two {
flex: 1 1 auto;
}
a {
text-decoration: none;
}
h1 {
display: block;
font-size: 1.3em;
margin: 0.67em 0;
font-weight: bold;
}
h2 {
display: block;
font-size: 0.8em;
margin: 0.83em 0;
font-weight: bold;
}
.container {
position: relative;
width: calc(50% - 20px);
margin: 10px;
}
.image {
display: block;
width: 100%;
height: 100%;
min-height: 75px;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: darkorchid;
min-height: 75px;
}
.container:hover .overlay {
opacity: 1;
}
.text {
color: Black;
font-size: 18px;
position: relative;
text-align: center;
padding: 10px;
}
.images-container{
display: flex;
flex-wrap: wrap;
}
<section>
<div class="flex-container">
<div class="one"> <h1> Welcome to Delicious Book store, <br>
where you can find so many delicious food!</h1>
<p> As a specialized book store, we have many cooking books on
holiday specials, vegetarian, desserts and cultural cuisines!</p>
</div>
<div class="two"> <h2> Shop By Category </h2>
<div class="images-container">
<div class="container">
<a href="category.html">
<img src="https://via.placeholder.com/150" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Holiday</div>
</div></a>
</div>
<div class="container">
<a href="category.html">
<img src="https://via.placeholder.com/150" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Dessert</div>
</div></a>
</div>
<div class="container">
<a href="category.html">
<img src="https://via.placeholder.com/150" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Vegetarian</div>
</div></a>
</div>
<div class="container">
<a href="category.html">
<img src="https://via.placeholder.com/150" alt="holiday image" class="image">
<div class="overlay">
<div class="text">Cultural Cuisine</div>
</div></a>
</div>
</div>
</div>
</div>
</section>

Mobile Safari: Image with 100% height not visible in absolute positioned container

Demo: http://codepen.io/malte/pen/kDlbt
I am using an absolute positioned wrapper to center an image in a thumbnail frame. (Only) On mobile safari, the image won't be displayed. if you inspect the .image-pos container you'll see that the height is properly set to its parent's size. applying a fixed px height to it will make the image show up... Does anyone know how to fix that?
It's working on any Desktop browser...
HTML:
<div class="wrapper">
<div class="thumb-grid">
<div class="thumb">
<a href="#" class="image">
<div class="image-pos">
<img src="http://images.weserv.nl/?url=static.living.is/gallery/original/5184f3631034bcdf16bd4d37c341928e.jpg&il&w=600" />
</div>
</a>
<div class="details">
<h5>Image Title</h5>
</div>
</div>
<div class="thumb">
<a href="#" class="image">
<div class="image-pos">
<img src="http://images.weserv.nl/?url=static.living.is/gallery/original/5184f3631034bcdf16bd4d37c341928e.jpg&il&w=600" />
</div>
</a>
<div class="details">
<h5>Image Title</h5>
</div>
</div>
<div class="thumb">
<a href="#" class="image">
<div class="image-pos">
<img src="http://images.weserv.nl/?url=static.living.is/gallery/original/016e551de2f53d58e7f4acd68279e6a1.JPG&il&w=600" />
</div>
</a>
<div class="details">
<h5>Image Title</h5>
</div>
</div>
</div>
</div>
CSS:
.wrapper {
width: 600px;
margin: 30px auto 0
}
.thumb-grid {
text-align: justify;
}
.thumb-grid:after {
content: '';
display: inline-block;
width: 100%;
}
.thumb {
position: relative;
display: inline-block;
width: 31.5%;
height: 0;
padding-top: 29%;
margin-bottom: 6%;
}
.image {
height: 73%;
overflow: hidden;
position: absolute;
text-align: center;
top: 0;
width: 100%;
vertical-align: top;
display: block;
border: 1px solid #eee;
}
.image-pos {
height: 100%;
left: 50%;
margin-left: -300px;
position: absolute;
text-align: center;
width: 600px;
}
.image-pos img {
height: 100%;
max-height: 100%;
min-height: 100%;
max-width: none;
width: auto;
display: inline;
border: 0;
}
.details {
height: 27%;
position: absolute;
top: 73%;
}
.details h5 {
margin: 0;
padding-top: 5px;
}
Demo: http://codepen.io/malte/pen/kDlbt