Ways to create a fading effect on an image without the need for an additional div

I am facing an issue with a page that displays product images. Whenever I hover over an image, it enlarges slightly but the max-height remains unchanged. To enhance this effect, I want the image to fade out on all sides rather than showing a white background. The challenge is that the image is clickable, so adding another div on top for the fade effect is not possible. Can anyone suggest a CSS solution to achieve this?

Here is the HTML code:

<li class="product">
    <article class="card ">
<figure class="card-figure">
    <a href="/audio-technica-pro-31/">
        <img class="card-image lazyautosizes lazyloaded" data-sizes="auto" src="https://cdn2.bigcommerce.com/server2400/7659a/images/stencil/500x659/products/1190/1191/pro_31_1__34951.1294215822.jpg?c=2" data-src="https://cdn2.bigcommerce.com/server2400/7659a/images/stencil/500x659/products/1190/1191/pro_31_1__34951.1294215822.jpg?c=2" alt="Audio Technica PRO 31" title="Audio Technica PRO 31" sizes="58px">
    </a>
    <figcaption class="card-figcaption">
        <div class="card-figcaption-body">
                    <a href="#" class="button button--small card-figcaption-button quickview" data-product-id="1190">Quick view</a>
                <label class="button button--small card-figcaption-button" for="compare-1190">
                    Compare <input type="checkbox" name="products[]" value="1190" id="compare-1190" data-compare-id="1190">
                </label>
                        <a href="/cart.php?action=add&amp;product_id=1190" class="button button--small card-figcaption-button">Add to Cart</a>
        </div>
    </figcaption>
</figure>
<div class="card-body">
        <p class="card-text" data-test-info-type="brandName">Audio Technica</p>
    <h4 class="card-title">
        <a href="/audio-technica-pro-31/">Audio Technica PRO 31</a>
    </h4>

    <div class="card-text" data-test-info-type="price">
                    <div class="price-section price-section--withoutTax ">
        <span data-product-price-without-tax="" class="price price--withoutTax">$52.99</span>
    </div>
    </div>
</div>

CSS applied:

.card{
    &:hover{
        .card-image{
            opacity:.75;
            transform: scale(1.05);
        }
    }
}

Answer №1

Did you give this a shot?

.image-box {
  opacity: 1;
  transition: all 1s ease;
}

.image-box:hover {
  opacity: 0.75;
  transform: scale(1.05);
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Triggering jQuery events can be customized by excluding certain elements using the

Is there a way to hide the div "popu" when clicking on the img "tri"? I've tried using .not() since the img is a child of the div popu, but it didn't work. Also, I need to make sure that clicking on the div "textb" does not trigger the hide actio ...

Ensure that the mask implemented in the form input only shows two decimal places, while simultaneously retaining the original value

Is there a way to format a number in a form input so that it displays only two decimals while still retaining the original value? This is necessary to avoid incorrect values down the line and meets the customer's requirement of showing no more than tw ...

Angular - issue with getting window.screen.height in template

One issue I'm facing is when attempting to optimize a section of my template for mobile devices in landscape mode. TS: window = window; Template: <div [ngStyle]="{'height': window.innerHeight < window.innerWidth ? window.screen ...

Despite locating the button, Protractor still encounters difficulties when attempting to click on it

I've been having trouble clicking on a button using Protractor. The issue is that even though the driver can locate the element, it still won't click on it. Any assistance would be greatly appreciated. Thank you in advance. Here is the HTML for ...

Text within table cells on email appears to be shrinking on Windows Phone devices

Can anyone help me understand why Windows Phone reduces the font size when text is placed within a table cell that isn't at 100% width or nested? Below is a screenshot of a test email template I'm working on. When I sent it to a Windows Phone 8. ...

Use ng-class in a P tag to assess a variety of expressions

Is there a way to apply ng-class to automatically evaluate negative values within a < p > tag? <p <strong>LW$:</strong> {{d.lw_metric}} <strong>LW:</strong> {{d.lw_metric_percentage}} <strong>L4W:</strong> {{ ...

IE 8 behaves in varying ways depending on the computer it is used on

Why might IE 8 behave differently on two separate machines? Specifically, when visiting this site: One machine experiences the issue of the "X" disappearing and not being able to minimize a slideshow after maximizing it. However, on another machine, even ...

Designing links within a web application

Currently, I am developing a web application that will contain a high volume of clickable elements. The challenge lies in maintaining a visually appealing design while adhering to web best practices such as using different colors and underlines for links. ...

Learn how to reposition the mat-option easily

I have an angular app with an autocomplete field that I need to adjust the position of. I have consulted the official documentation under the method updatePosition, which states: "Updates the position of the autocomplete suggestion panel to ensure that it ...

Make real-time edits to JavaScript code on a webpage

Is there a method aside from using Firebug in the DOM view to edit live JavaScript embedded within an HTML page? For example, code like this within a .html file: <script type="text/javascript> // code here </script> Thank you. ...

Unable to conceal adjacent element when z-index is set as 1

I encountered an issue where a modal is overlapping another element, and the close button of the underlying element has a z-index of 1. Despite creating a new modal with its own close button, the original close button remains visible on top. I attempted t ...

The hover effect does not function on an SVG element when it is placed within an external file

I've been experimenting with SVG animation. My goal is to change the color of a circle when it's hovered over. <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 437 ...

Tips for including HTML tags in strings without causing issues with nested tags

I am struggling with a string that contains both text and HTML tags, specifically <a href=""></a> tags. My goal is to apply the "i" tag around the text outside of the "a" tags without creating nested tags like: <i><a href=""></a ...

Enhanced jQuery implementation for hiding elements

I encountered a peculiar issue where jQuery's .is(':hidden') function wrongly returned true for an element that visibly displayed content. You can see the problem demonstrated in this fiddle. The :hidden pseudo checks both offsetWidth and o ...

What is the best way to position a row of divs above their parent div?

Need guidance on placing a row of divs (each with 3 columns of images) on top of a parent div (image) using Bootstrap 5. Previously used position: absolute, but encountering overflow issues. Attempted overflow: visible as well. Provided below is the code s ...

Ways to execute a task based on various selection option values?

Is there a way to dynamically change the API key value based on the selected currency option? For example, I want to display prices in different currencies like INR, USD, EUR, etc., each requiring a different API key. <select class="form-select for ...

generate a different identifier for ajax requests avoiding the use of JSON

The AJAX request functions in the following way: success: function(data) { $('#totalvotes1').text(data); } However, I need it to work with unique IDs as follows: success: function(data) { $('#total_' + $(this).attr("id")). t ...

Ensuring divs are centered when resizing the page

Is there a way to center an unordered list of tables while ensuring that it remains centered even when the window is resized? The list should move each table to a new line if they can no longer fit. Check out the code snippet below for reference: <d ...

jQuery UI Sortable: Efficiently Drag Items Across Multiple Interconnected Lists

One feature of using jQuery UI Sortable is the ability to make the sortable item container scroll when an item is dragged. This can be achieved by specifying the scroll option. In my case, I have several sortable lists that are connected within separate c ...

Tips for creating a dynamic menu with animated effects

Check out my fiddle here: http://jsfiddle.net/k3AHM/23/ $(document).scroll(function () { var y = $(this).scrollTop(); if (y > 110) { $('.menu-container').addClass( "fix-menu" ).animate('top', '-3px&a ...