Understanding the z-index property in webkit transitions

I'm currently working on a web page where I have multiple divs floated in the same direction, each with a specified width to create a grid layout. I'm attempting to use the -webkit scale effect to zoom in on a hovered div while reducing the opacity of the other divs.

The issue arises when the first div in the stack is hovered over and scaled, causing it to overlap partially with the next div with reduced opacity.

Here's an example of the code:

<div id="div1" class="tile">Content 1</div>
<div id="div2" class="tile">Content 2</div>
<div id="div3" class="tile">Content 3</div>

CSS:

    .tile{
    width:100px;
    margin:6px;
    float:left;
    height:100px;
    margin-right:0px;
    margin-bottom:0px;
    -webkit-transition: all .1s ease-in-out .1s; 
    -moz-transition: all .1s ease-in-out .1s;   
    }
     .tile:hover{
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -moz-box-shadow: 0 0 3px 1px #fff;
    -webkit-box-shadow: 0 0 3px 1px #fff;
    box-shadow: 0 0 3px 1px #333;

     }

JQuery:

    function tile_mouseover()
    {
    $(this).siblings('.tile').stop(true,true).animate({'opacity':'0.5'},300);
    $(this).stop(true,true).animate({opacity:1},200)
    }

When implementing this code, the scaling of div1 causes overlapping with div2. Any suggestions for a solution?

Answer №1

I believe this solution is effective.

.box {
  position: absolute;
}
.box:hover{
  z-index:3;
}

Answer №2

There appears to be a double declaration of margin in your .tile class, the correction can be made as follows:

.tile{
width:100px;
margin:6px;
float:left;
height:100px;
-webkit-transition: all .1s ease-in-out .1s; 
-moz-transition: all .1s ease-in-out .1s;   
}

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

Design a custom cover page before printing using the window.print() method

When it comes to printing, I have a header and footer displayed on each page. However, I want the first page to be clean with just a picture or title, without the header and footer that appear on subsequent pages. I've attempted to use CSS like this ...

Dynamic expand/collapse animation in React with adjustable height feature

I'm currently working on an Expand component and attempting to implement an expand animation upon toggle without success. I want this animation to be dynamic without explicitly setting the element's height: export const Expand = ({ startOpen, con ...

An uncomplicated application designed to showcase a moving sphere

<!DOCTYPE html> <html> <head> <script type="text/javascript"> var canvas_element; var initial_x = 200; var initial_y = 300; var x_movement = 1; function start_canvas() {setInterval(draw_circle, 10); canvas_element = bouncing_ball_c ...

Combining all elements of my application into a single HTML, JS, and CSS file

My AngularJS app has a specific structure that includes different directories for each component: theprojectroot |- src | |- app | | |- index.html | | |- index.js | | |- userhome | | | |- userhome.html | | | ...

Creating Filled DIVs using JavaScript

Although it may appear to be a common inquiry, my specific needs have not been addressed in any of the Stack threads I've come across. I am dealing with a series of nested DIV statements, as demonstrated here (not all CSS included). I am looking to ...

What is the best way to incorporate a color-changing animation into a countdown border, resembling a spinner?

I am looking to implement a timer using jQuery that will start once this circle on the page is reached. The idea is for the border color (currently white) to progressively change to red, resembling a loading spinner effect commonly seen online. After reach ...

The issue with displaying inline block is that the divs are not appearing side by side on the

Two of my div elements, namely form-panel and data-panel, are currently not aligned on the same line. How can I use display:inline-block to align them in a single line? Please review the code provided below. I have already used display:inline-block on both ...

Vertical alignment to the top is not possible for Inline-Block divs

When attempting to create a responsive 'grid' with two (div) panels that appear side by side on wide screens and stacked on top of each other on smaller screens, I came across an issue where the divs align at the bottom when displayed as 'bl ...

Setting a defined width and using block display will not solve the issue of the margin:auto not working

rough sketch of my desired design I am trying to center a label on the page. The parent container is set to a width of 100% and the label itself is displayed as a block element with margin set to auto. When I set the width of the label to a smaller value, ...

Unsuccessful attempt at a basic CSS transition - no success

I'm currently trying to create an image with a gradient that disappears on hover, but I'm struggling to get the transition effect to work. I've experimented with various webkit transitions without success. Here's the HTML: <a href= ...

Submitting a form in a jQuery Mobile native application to redirect to a different page

I am embarking on my inaugural attempt at developing a native mobile application using jQuery Mobile, which will subsequently be wrapped in PhoneGap. Although I am new to the world of mobile application development, I am currently facing a minor roadblock. ...

Flexbox for creating pop-up menus

I'm currently working on creating a header component using FlexBox. Here is a visual representation of what I am aiming for: https://i.sstatic.net/wRFHR.png The red box represents a flexbox, while the green boxes are individual <div> elements ...

Tips for implementing active pagination state that persists even after refreshing the page

Currently using the Admin LTE theme and encountering an issue with its datatable. I would like the pagination tab to remain active even after a page refresh. Can anyone provide assistance with this? Here is the link to the pagination table: The image att ...

When there are multiple elements within the parent container, the CSS hover margin-top alteration fails to take effect

I am currently working on creating a dynamic menu bar that has elements which smoothly move upwards on hover. However, I have encountered an issue where this movement effect only works when the parent container contains exactly one element (such as in titl ...

Tips for arranging columns and rows in a mat-dialog box

In my Angular project, I am working on a mat dialog box and trying to achieve a layout with 1 row at the top and 3 rows at the bottom, similar to the image below. However, I am facing issues in making it work properly. Additionally, I want to hide the hori ...

Learn how to divide column layouts into precise measurements and create a container that cannot be scrolled using Angular Nebular

I am currently utilizing the nebular theme and have set a fixed header. I am attempting to split columns with specified width and height, but for some reason, my width and height properties in the local component scss are not affecting the column layouts c ...

Is there a way to retain page state even after navigating away and returning?

I have successfully implemented a button feature that expands the Read More section on my website. // CODE FOR EXPANDING READ MORE SECTION $("#readMoreDiary").on("click", function(){ $("#diary-content").addClass("showTextThree"); $("#readMoreDiar ...

Finding the xPath for a particular line within a node that contains more than one line of text

My HTML code resembles the following structure: <div class='textContainer'> <div class='textLabel'> </div> <div class='text'> "First Line of text" "Second Line of text" "Thir ...

Arranging Bootstrap 4 columns in a vertical stack

My HTML code is as follows: <html> <head> <title>Title</title> <meta charset="utf-8"> <meta name="description" content="description"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <li ...

Is it possible to modify the CSS styling in React using the following demonstration?

I am attempting to create an interactive feature where a ball moves to the location where the mouse is clicked. Although the X and Y coordinates are being logged successfully, the ball itself is not moving. Can anyone help me identify what I might be overl ...