Hey there, folks! Are you looking to jazz up your website's image galleries? Well, you've come to the right place! In this tutorial, we'll show you how to create an image with accordion effect on hover using HTML and CSS.
First off, let's chat about HTML and CSS. HTML is like the building blocks of web pages, while CSS adds style and personality to your website.
By combining these two, you can create some seriously cool designs that'll knock your user's socks off!In this tutorial, we're gonna be using CSS animation effects to make an accordion effect on an image when a user hovers over it. It's a slick way to add a bit of movement and interactivity to your web design.
To get started, we'll walk you through creating a basic HTML structure for your image.
Then, we'll apply some CSS styles to give it that fancy accordion look. Finally, we'll create a hover effect using CSS animation that'll make your image expand and collapse like magic! This tutorial is perfect for website designers and developers who want to learn more about front-end development. Whether you're a beginner or a pro, we've got you covered with all the tips and tricks you need to create stunning website designs.
At this Online Tutorials, we're all about providing high-quality web design and development tutorials that are easy to follow and understand. Our goal is to help aspiring web designers and developers learn the skills they need to succeed in this exciting field. So if you're interested in learning more about web design and development, be sure to check out our playlists for HTML and CSS tutorials, CSS image animation, accordion effects, and much more. We've got everything you need to take your web design game to the next level! In conclusion, creating an image with accordion effect on hover using HTML and CSS is a fun and easy way to add some pizzazz to your website. So what are you waiting for? Let's get started!
index.html
<html>
<head>
<title>TUTORIAL</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="ctr-accordion">
<div class="tab">
<img src="images/image1.jpg">
</div>
<div class="tab">
<img src="images/image2.jpg">
</div>
<div class="tab">
<img src="images/image3.jpg">
</div>
<div class="tab">
<img src="images/image4.jpg">
</div>
<div class="tab">
<img src="images/image5.jpg">
</div>
</div>
</body>
</html>
style.css
*{
box-sizing: border-box;
}
body{
width: 100%;
margin: 0;
padding: 0;
background-color: #292430;
}
.ctr-accordion{
max-width: 1400px;
height: 720px;
display: flex;
flex-direction: row;
align-items: center;
align-content: space-around;
gap: 20px;
overflow: hidden;
margin: 150px auto;
}
.tab{
position: relative;
width: 20%;
height: inherit;
padding: 20px;
background: rgb(150,150,150);
cursor: pointer;
transition: width .5s ease;
border-radius: 25px;
}
.tab img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
transition: all 0.5s ease;
border-radius: 25px;
}
.tab:hover img{
opacity: 0.6;
}
.tab:hover{
width: 80%;
}
Watch Full Video Here!
Comments
Post a Comment