Snippets

Background and caption transitions

June 21, 2017

animation caption hover

Background and caption transitions

Lipsum

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat esse vel autem, id nobis aliquid, quo voluptatibus sed molestiae aspernatur dignissimos quos atque fuga quas ex deleniti error, at consectetur.

<div class="article"> <div class="article-background" style="background-image: url(http://vizua.net/dummy.jpg);"></div> <div class="article-content"> <h2>Lipsum</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat esse vel autem, id nobis aliquid, quo voluptatibus sed molestiae aspernatur dignissimos quos atque fuga quas ex deleniti error, at consectetur.</p> </div> </div> .article { position: relative; height: 300px; overflow: hidden; width: 300px; } .article-background { position: absolute; top: -33%; right: 0; bottom: 33%; left: 0; background-size: cover; z-index: 100; } .article-content { position: absolute; top: 67%; right: 0; bottom: 0; left: 0; padding: 15px; background: rgba(0,0,0, .6); color: #fff; z-index: 200; } .article-background, .article-content { -moz-transition: all .4s; -webkit-transition: all .4s; transition: all .4s; } .article:hover .article-background { top: 0; bottom: 0; } .article:hover .article-content { top: 100%; } .article:hover .article-content:hover { top: 0; } /* default .article : end */ /* checkzone .article */ .article-content-checkzone { position: absolute; top: 80%; right: 0; bottom: 0; left: 0; background: #888; /* remove it for use */ z-index: 400; } .article:hover .article-content-checkzone:hover + .article-content { top: 0; }

Related Content

Easy Way to Fix Anchor Links Scrolling Too Far

Stories

Easy Way to Fix Anchor Links Scrolling Too Far

Fixed navbar is a very popular way of displaying navigation when a page is scrolled, but you could run into a small detail that needs to be addressed.

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

Stories

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

There are certain cases when you want to dynamically manipulate the page height which will result in flickering.

Changing the Mouse Cursor in CSS With the cursor Property

Stories

Changing the Mouse Cursor in CSS With the cursor Property

Using CSS to change the cursor on your website is a great way to add a little bit of personality to your site.