What are the possible solutions for resolving this complex CSS positioning problem?

I am currently in the process of designing a website and have been exploring ways to implement a hover animation using CSS.

<html> 
...
<body>
<div id ="outer_container">
    <div id="inner_container">
        <img id="imageOne"/>
    </div>
</div>
...

</body>
<html>

The outer_container spans the entire width of the page

As for the inner_container, it is positioned within the outer_container and centered vertically.

In the CSS animation, there is a concealed element known as 'blur', which essentially functions as a colored block that matches the dimensions of the image. When hovered over, the "blur" appears on top of the <img/> tag located within the inner_container div.

However, due to using

"position : relative / position : absolute"
, the block element "blur" ends up overlapping with the image tag and disrupts the alignment achieved with display : inline-block between the inner_container and outer_container divs.

I am seeking an alternative solution that would enable the hidden element to be displayed on top of the <img/> tag in the inner_container without the need for

"position : relative / position : absolute"

This way, I can maintain the alignment of the inner_container inside the outer_container.

To view the actual code, you can visit this link

Answer №1

Assigning a z-index value to each element is important: elements with a higher z-index will appear in front of elements with a lower z-index.

For example:

box{
  z-index:0;
}
image,inner-box{
  z-index:2;
}

If you want the outer-box to appear 'behind', you can give it a z-index of -2.

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

Positioning Anchors in HTML Tables within the Viewport: A Comprehensive Guide

I am utilizing anchor elements within an HTML table and aiming to incorporate some spacing at the top of the viewport. I have discovered that by placing the anchor inside a dummy DIV element within the TD, I can achieve this. However, my goal is also to hi ...

Is there a way to incorporate a delete button for each li element that is included in my list?

I have successfully implemented a to-do list where clicking on an item strikes a line through it and there is a delete button that works. However, I am looking for assistance on how to create a delete button for each newly added li item. var button = do ...

Modify the text in a paragraph by clicking on a link using JQuery and HTML

I'm attempting to implement a straightforward action, but I'm facing some challenges. My navigation bar consists of a few links followed by a text section. What I aim for is that when I click on a link, the paragraph of text should change to refl ...

Struggling with aligning text within a rectangular container?

I am struggling with text placement within a div. I'm working on positioning the image in the top right corner (which I've achieved) and centering the bottom text inside the box. For reference, this is what I aim to accomplish: http://jsfiddle.n ...

The dialog box does not display properly on the screen when selecting multiple files

When I try to upload more than 25 files in the dialog box, the length of the box increases and there is no scrollbar to view all the files. Check out the screenshot: https://i.sstatic.net/vBcsh.png I added 36 files but couldn't see them all at once ...

Looking to adjust the background-image size of a table cell (td) upon clicking a specific

I have a website where I would like to display logos of different games with links attached to them. I have managed to adjust the size of the image on hover, but now I am looking for a way to keep the size bigger after clicking on the link. Is there a simp ...

"Utilize PrimeNG's p-tabpanel to bind a unique style class to

When using the tabview component from PrimeNG, I am encountering an issue where I am unable to bind a header style class. Here is my static HTML code that works: <p-tabPanel header="Title" headerStyleClass="badge" formGroupName=&quo ...

"If the user presses the backspace key on the keyboard, jQuery will automatically navigate to the previous input

I'm currently working with a jQuery script: $(document).ready(function() { //Focus the first field on page load $(':input:enabled:visible:first').focus(); //Clear all fields on page load $(':input').each(function() ...

Issue with setting a background image to a div in Next.js: not functioning as expected

I haven't used Next.js before and I'm having trouble setting a background image for a specific div. I have a folder named public in the root directory where I've placed the file art-thing.jpg. My styles.css is also in the root directory, whi ...

Trim image for creating a CSS background design

Is there someone who can assist me in resizing this dragon scale to use as a CSS background pattern? I attempted to resize it myself but it was not accurate. Thank you in advance! Dragon scale image: ...

Initial letter standing out above all others in printed materials

Everything on my webpage looks great, but when I try to print it out, the text ends up appearing like this image. I am utilizing bootstrap 4 and below you will find the code lines for the elements depicted in the image. <h3 class="text-center">RESUL ...

What could be causing my JavaScript code to malfunction, even though it appears to be coded correctly?

// JavaScript Document "use strict"; $(window).scroll(function(){ if($(window).scroll() > 100){ $("#scrollTop").fadeIn(); } }); $(window).scroll(function(){ if($(window).scroll() < 100){ $("#scrollTop").fadeOut(); } }); $(document).ready(function() ...

I need help figuring out how to get a horizontal scrollbar positioned at the top of a div to function properly once the content has been loaded using ajax

HTML CODE <div id="scrollidout" style="overflow: auto; overflow-y: hidden; "> <div id="scrollidin" style="padding-top: 1px; height: 20px; width: 1000px">&nbsp;</div> </div> <div class="resultcontent" style="overflow ...

Troubles with concealing dropdown menu when hovering

I have noticed that this issue has been raised before, but none of the solutions provided seem to fix my problem specifically. The submenu in my menu is not functioning as intended. It should be displayed when hovered over and hidden when not being hovere ...

What is causing this alert to remain open?

I've been struggling to close the alert within the body section. I've tried various fixes but can't seem to figure it out. Can anyone spot what's wrong here? It's just a practice exercise, but I'd really appreciate some help. ...

The website is unable to detect the newly created .scss file

I am new to scss and currently using a Portfolio Template for my website. Recently, I added an extra section to the website. I noticed that when I define a style in an existing _file.scss file, it works perfectly fine. However, when I create a new _filenam ...

Get Your Business Rolling with the Shopify Cruise Theme

I'm currently utilizing the ride theme on my Shopify website and I've embedded a video in an index.json file: "video_url": "https:\/\/www.youtube.com\/watch?v=KlxiEKrhWIQ", Is there a way to make the video aut ...

How to rename a class of an image tag using jQuery

I need to update the class name in my image tag <img src="img/nex2.jpeg" class="name"> When hovering over with jquery, I want to add a new class to it. After hovering, the tag should appear as follows: <img src="img/nex2.jpeg" class="name seco ...

Press the button obscured by an image

Recently on my HTML website, I encountered an issue where I tried adding a transparent image over a button but found that I was unable to click on the button afterwards. The problem seems to be related to the following code snippet: #container { heigh ...

Is it possible to show only a snippet of the title on the main blog page of WordPress

Seeking assistance in displaying a condensed version of a blog post's title on the blog's main page along with a thumbnail image. While I've come across several resources on showcasing post excerpts, I have yet to find information on trimmin ...