Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Image Border on Hover"
Bootstrap 4.1.1 Snippet by
sarwal
4.1.1
Preview
HTML
CSS
View Full Screen
Fork
Fork this
2.5K
 
1 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container-fluid"> <div class="row bg-secondary p-0"> <div class="col-12 text-center mx-auto p-5"> <div class="demo-title"> Bordered Image Content on Hover </div> <div class="credit-title"> Designed by <a href="https://bootsnipp.com/sarwal" target="_blank" class="text-light">sarwal</a>. Inspired by <a href="https://bootsnipp.com/prakash27dec" target="_blank" class="text-light">prakash27dec</a>. </div> </div> </div> <div class="row bg-dark p-1"> <div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-12 mx-auto p-1"> <div class="hover-box"> <img src="https://cdn.pixabay.com/photo/2017/06/17/12/59/luxury-home-2412145_960_720.jpg"> <div class="hover-box-content"> <div class="hover-box-title"> Lorem Ipsum </div> <div class="hover-box-desc"> Lorem ipsum dolor sit amet. </div> </div> </div> </div> <div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-12 mx-auto p-1"> <div class="hover-box"> <img src="https://cdn.pixabay.com/photo/2016/08/16/03/50/exterior-1597098_960_720.jpg"> <div class="hover-box-content"> <div class="hover-box-title"> Lorem Ipsum </div> <div class="hover-box-desc"> Lorem ipsum dolor sit amet. </div> </div> </div> </div> <div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-12 mx-auto p-1"> <div class="hover-box"> <img src="https://cdn.pixabay.com/photo/2017/06/17/12/59/luxury-home-2412145_960_720.jpg"> <div class="hover-box-content"> <div class="hover-box-title"> Lorem Ipsum </div> <div class="hover-box-desc"> Lorem ipsum dolor sit amet. </div> </div> </div> </div> <div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 col-12 mx-auto p-1"> <div class="hover-box"> <img src="https://cdn.pixabay.com/photo/2016/08/16/03/50/exterior-1597098_960_720.jpg"> <div class="hover-box-content"> <div class="hover-box-title"> Lorem Ipsum </div> <div class="hover-box-desc"> Lorem ipsum dolor sit amet. </div> </div> </div> </div> </div> </div>
/* Importing the Font Families used in this Demo */ @import url('https://fonts.googleapis.com/css?family=Playfair+Display:700&display=swap'); @import url('https://fonts.googleapis.com/css?family=Montserrat:500&display=swap'); /* Removable Title at Top of Demo */ .demo-title { font-family: 'Playfair Display', serif; font-weight: normal; font-size: 45px; color: #FFFFFF; } /* Removable Description at Bottom of Demo */ .credit-title { font-family: 'Montserrat', sans-serif; font-weight: normal; font-size: 0.9rem; color: #FFFFFF; } /* Initial Hover Box Setup */ .hover-box { position: relative; overflow: hidden; text-align: center; } /* Initial Setup of the Top and Bottom Borders on Hover */ .hover-box:before { border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF; content: ''; z-index: 2; position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; transform: scaleX(0); transition: all 0.5s ease; opacity: 0; } /* Initial Setup of the Left and Right Borders on Hover */ .hover-box:after { border-left: 1px solid #FFFFFF; border-right: 1px solid #FFFFFF; content: ''; z-index: 2; position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; transform: scaleY(0); transition: all 0.5s ease; opacity: 0; } /* Image Sizing Setup */ .hover-box img { width: 100%; height: auto; overflow: hidden; transform: scale(1.1); transition: all 0.5s ease; } /* Initial Setup of Box Content */ .hover-box .hover-box-content { position: absolute; top: 5%; left: 5%; width: 90%; height: 90%; overflow: hidden; transition: all 0.5s ease; opacity: 1; z-index: 2; } /* Initial Setup of Box Content Title */ .hover-box .hover-box-content .hover-box-title { position: absolute; top: 20%; left: 0%; width: 100%; height: auto; font-family: 'Playfair Display', serif; font-weight: normal; font-size: 20px; transition: all 0.5s ease; opacity: 0; color: #FFFFFF; } /* Initial Setup of Box Content Description Paragraphs */ .hover-box .hover-box-content .hover-box-desc { position: absolute; bottom: 20%; left: 0%; width: 100%; height: auto; font-family: 'Montserrat', sans-serif; font-weight: normal; font-size: 0.9rem; transition: all 0.5s ease; opacity: 0; color: #FFFFFF; } /* Hover Effects on Image Styling */ .hover-box:hover img { transform: scale(1); filter: brightness(0.5); } /* Hover Effects to Display the Top and Bottom Borders */ .hover-box:hover:before { transform: scaleX(1); opacity: 1; } /* Hover Effects to Display the Left and Right Borders */ .hover-box:hover:after { transform: scaleY(1); opacity: 1; } /* Hover Effects to Move the Title Position */ .hover-box:hover .hover-box-content .hover-box-title { top: 35%; opacity: 1; } /* Hover Effects to Move the Description Position */ .hover-box:hover .hover-box-content .hover-box-desc { bottom: 35%; opacity: 1; }
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76