Prevent blurring on a sub-element when hovering over a blurred container using Bootstrap 5.2

Can anyone help me prevent a blur effect on the "text-block" child element when the mouse hovers over the card element? I want the card element to have a complete blur effect while also displaying the text block on top of it.

I've tried several options but none seem to work. Thank you in advance for any assistance.

  <div class="container"> 
    <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
      <div class="col">
        <div class="card shadow-sm">
          <div class="container my-2">
            <a href="/Zanzibar.html"><img src="./images/mnemba_view.JPG" class="w-100 w-sm-120 preview"/></a>
            <div class="text-block">Click to read more</div>
          </div>  `
.card {
  position: relative;
  display: flex; 
  justify-content: center; 
  align-items: center; 
}

.preview {
  position: relative;
}

.text-block {
  position: absolute;
  opacity: 0;
  z-index: 1;
  bottom: 0;
  top: 50%;
  left: 50%;
  block-size: 50px;
  inline-size: 200px;
  padding: 10px 10px;
  background-color: rgb(189, 113, 20);
  color: white;
  border-radius: 10px;
}

.card:hover .text-block{
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

.card:not(hover) .text-block {
  transition: 0.4s;
}

.card:hover {
  filter: blur(2px);
  cursor: pointer; 
}

Answer №1

After some searching, I finally uncovered the answer.

Allow me to present the solution:

  .text-block {
    position: absolute;
    opacity: 0;
    bottom: 0;
    top: 50%;
    left: 50%;
    block-size: 50px;
    transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    inline-size: 200px;
    background-color: rgb(189, 113, 20);
    color: white;
    border-radius: 10px;
    pointer-events: none;
    text-align: center;
    }
    <div class="album py-5">
      <div class="container">
        <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
          <div class="col">
            <div class="card shadow-sm">
              <div class="card-header fw-bold" style="background-color:#b76800a9">Africa</div>
                <div class="preview">
                  <a href="/Zanzibar.html"><img src="./images/mnemba_view.JPG" alt="Ile de Mnemba" class="w-100 h-sm-200 w-sm-120 align-item-center justify-content-center"/></a>
                  <button class="text-block">Click to read more</button>
                </div>

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

Bootstrap Dropdown Functionality Malfunctioning

Here is a simple piece of HTML code that I have created: <!doctype html> <html> <head> <meta charset="utf-8"> <title>.:Home Page:. The Indian Sentinel</title> <link rel="stylesheet" href=" ...

"Enhance Your Website with Dynamic Text Effects using JavaScript

Is there a way to continuously animate text during the loading process of an AJAX request? I've tried implementing various methods, such as using a setTimeout function or an infinite loop, but nothing seems to work for repeating the animation once it& ...

Having trouble running the npm script due to a multitude of errors popping up

I have encountered an issue while trying to run an npm script. I added the script in the `package.json` file multiple times, but it keeps showing errors. I am currently working on building a website and require npm sass for it. However, when I try to run t ...

Transition animation when switching between divs in React -

Currently, I am utilizing react-transition-group to assist in managing transitions between different elements. My goal is to create a quiz where each question slides over the previous one once a user answers it. However, I've encountered an issue with ...

Streamlining Tailwind CSS styles in your React/Next.js components for maximum efficiency

Since implementing Tailwind CSS in my React/Next.js project, I've noticed a decrease in maintainability compared to using traditional CSS or styled-components. Previously, I could easily consolidate style changes, but now I find myself duplicating cla ...

Avoid having a pre tag enclosed long line exceed its container's width

Within the <pre> </pre> tags, I have a lengthy single line of text that needs formatting. Is there a method to automatically wrap the text or must I manually insert <br> tags within the text? ...

The reliability of next router events can sometimes be called into question as they do not always function consistently

I've been working on creating a loading screen for my Next.js project. The issue I'm facing is that sometimes the loading message stays on the screen and doesn't go away even after the page has loaded. I suspect this may be due to the state ...

In IE, the hover state of the background color and sub menu is frequently toggling

I've been struggling with this issue all week. I have a CSS dropdown menu that uses both standard lists and content boxes as sub menus. The problem lies in IE, where each LI has an anchor tag that is set to display block in order to fill the parent LI ...

Transforming a menu tab into an active anchor when navigating to a particular section

Hello, I have successfully created a JavaScript code that can dynamically add menu tabs into the menu list window.addEventListener("load", () => { const navList = document.getElementById("nav_list") const fragment ...

What is the recommended method for choosing text colors when creating GUI for app development?

Currently preparing PSDs for the development of both an iOS and Android app. When it comes to coloring text, should I: 1) Utilize #000000 for black text, adjusting opacity to achieve various shades of gray for primary and secondary text? 2) Or opt for a ...

How to prevent npm from being accessed through the command prompt

I recently began working on a ReactJs project. However, I am facing an issue where after starting npm in Command Prompt, I am unable to enter any text. Should I close the cmd window or is there a way to stop npm? You can now access your project at the fol ...

Tips for displaying a PNG image correctly within the navbar

I'm facing an issue with adding a logo to the navigation bar, as the logo I want to use doesn't display correctly. Even after trying to adjust the width and height, it continues to stretch inappropriately and the text on the image remains unread ...

Ways to achieve perfect alignment for SVG text within its container, as opposed to stretching across the entire webpage

Recently, I've been working on a customizable photo frame designer using SVG. One of the key features allows users to add their own text to the frame. To achieve this, I'm utilizing jQuery's .keyup function. However, the issue I'm facin ...

Is there a way to make all the burger bars change color when hovered over in my ReactJS/NextJS application?

Recently, I encountered an issue with my hamburger menu. When I hover over one of the bars, only that specific one changes color and not all of them. I am struggling to figure out how to make all the bars change color when any one of them is hovered over. ...

Can this PHP code be optimized for better efficiency?

Seeking to create dynamic links on a page where the link for the current page is excluded. The code functions as desired but seems repetitive - hoping for a more efficient solution, given limited programming experience. <div class= "links"> <?php ...

Eliminate the link outline in p:tabView

How can the outline be removed when a user clicks on one of the tabs in <p:tabView>? Attempts to set it in CSS were unsuccessful. a { outline: 0 none !important; } Shown below is a screenshot of the issue. ...

How to Ensure an Absolutely Positioned Element Occupies the Full Width of its Container

My main content area has a sidebar positioned absolutely to the right side due to various reasons. However, I am facing an issue where if the main content area is shorter, the sidebar extends beyond the content. Do you know of any CSS technique that can h ...

React's Bootstrap Modal Failing to Close

Check out the following modal component. The issue seems to be with the code block where (isPending == "hide") triggers a console.log, but bsModal.hide() doesn't function as expected. If I remove the bsModal.show() line of code, the modal ...

jQuery is used to make an object fade out once another object has been moved into place

As I delve into the world of jQuery, I've decided to create a simple Super Mario imitation. The concept is to control Mario using arrow keys and fade out mushrooms once Mario reaches them. However, my attempts at achieving this result have not been su ...

I'm having trouble getting my PrimeNG Calendar component to line up correctly

::ng-deep p-calendar.calendar-control > span > input.p-inputtext { border: 1px solid black; background: #eeeeee; text-align: center !important; } The content is not properly centered. <p-calendar dateFormat="mm/dd/yy&qu ...