Shopify themes, liquid, logos, and UX
I would like to add a text hover to product images on my home page. How do I go about this.
Adding a text hover effect to product images.
--------- HTML CODE START --------------
<div class="product">
<img src="Image File/Link" alt="Product 1">
<p class="product-text">Car 1 Detail Write here...........</p>
</div>
<div class="product">
<img src="Image File/Link" alt="Product 2">
<p class="product-text">Car 2 Details Write Here</p>
</div>
--------- HTML CODE END --------------
-------CSS CODE START --------------
<style>
.product {
position: relative; /* Needed for absolute positioning of text */
}
.product-text {
position: absolute; /* Position text absolutely relative to its container */
left: 10px;
top: 50;
opacity: 0; /* Initially invisible */
background-color: rgba(0, 0, 0,0.9); /* Background color for text */
color: #fff; /* Text color */
padding: 10px;
text-alight: center;
transition: opacity 0.3s ease-in; /* Smooth transition for opacity */
}
.product:hover .product-text {
opacity: 1; /* Show text on hover */
text-alight: center;
}
.product:hover{
filter: grayscale(20%);
opacity: 0.8;
}
</style>
-------CSS CODE END--------------
If I managed to help you then, don't forget to Like it and Mark it as Solutions.
I am having trouble pasting this code. Can you assist me please.
User | RANK |
---|---|
208 | |
177 | |
63 | |
51 | |
47 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023