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
"Expanding card"
Bootstrap 4.1.1 Snippet by
dipakextra
4.1.1
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
1.0K
 
0 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"> <div class="row"> <body> <div class="image-container"> <div class="image image1"> <img src="https://images.unsplash.com/photo-1471922694854-ff1b63b20054?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1052&q=80" alt="sea"> <h3 class="image-tittle">sea beach</h3> </div> <div class="image image1"> <img src="https://images.unsplash.com/photo-1486072889922-9aea1fc0a34d?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8bW91dGFpbnxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt="sea"> <h3 class="image-tittle">moutain</h3> </div> <div class="image image2"> <img src="https://images.unsplash.com/photo-1616849675415-d0f1727e2559?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80" alt="sea"> <h3 class="image-tittle">sunset</h3> </div> <div class="image image3 active"> <img src="https://images.unsplash.com/photo-1541423408854-5df732b6f6d1?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80" alt="sea"> <h3 class="image-tittle">city at night</h3> </div> </div> </body> </div> </div>
html { font-size: 62.5%; } * { margin: 0; padding: 0; box-sizing: border-box; } body { height: 100vh; background-color: #90caf9; padding: 5rem; display: flex; align-items: center; justify-content: center; } .image-container { width: 90%; height: 100%; display: flex; overflow: hidden; } .image { position: relative; flex: 0.4; margin-right: 1rem; border-radius: 3px; transition: flex 1s ease-in; cursor: pointer; } .image img { width: 100%; height: 100%; object-fit: cover; border-radius: 50px; } .image.active { flex: 5; } .image-tittle { color: white; position: absolute; top: 80%; left: 0; margin-left: 3rem; font-size: 3rem; text-transform: capitalize; opacity: 0; } .image.active .image-tittle { opacity: 1; transition: opacity 0.3s ease-in 0.4s; }
const images = document.querySelectorAll(".image"); if (images) { images.forEach((image) => { image.onclick = () => { document.querySelector(".active").classList.remove("active"); image.classList.add("active"); }; }); }
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76