How can I change the z-index of objects in Webflow so that the cursor is not placed behind images?

TL;DR
  • Set the custom cursor’s position to fixed or absolute and assign it a high z-index (e.g., 9999).  
  • Lower the z-index of overlapping elements, avoid nesting the cursor in containers with overflow: hidden, and if using custom code, append the cursor to the body.

If your custom cursor or interactive element is appearing behind other objects in Webflow, adjusting the z-index is essential to fix the stacking order. Here's how to ensure your cursor sits above all other elements.

​

1. Create or Select the Cursor Element

​

  • Ensure your cursor is a separate element, typically a div set to follow the mouse using Webflow interactions or custom code.
  • Give it a distinct class name (e.g., custom-cursor) for easy targeting.

​

2. Set the Cursor’s Positioning

​

  • Select the cursor element and go to the Style panel.
  • Under Position, set it to fixed or absolute (depending on your design), usually with all sides set to auto.

​

3. Increase the Z-Index of the Cursor

​

  • Still in the Style panel, scroll to the Z-index property.
  • Set a high z-index value, for example: 9999.

​

4. Lower Z-Index of Background Elements if Needed

​

  • Identify images or sections that may be overlapping or blocking the cursor.
  • Reduce their z-index (e.g., z-index: 1) or remove any unnecessary z-index values.

​

5. Use Webflow Navigator to Check Element Hierarchy

​

  • Open the Navigator panel to review the hierarchy and stacking context.
  • Ensure the cursor is not nested inside an element with restricted overflow, like a section with overflow: hidden, unless needed.

​

6. If Using Custom Code, Append to Body

​

  • If you're injecting the cursor element via custom code, ensure it’s added to the end of the body, so it stacks on top.
  • Use document.body.appendChild(cursorElement) in your script.

​

7. Check Overflow and Display Properties

​

  • Make sure no parent container of the cursor has overflow: hidden, which may clip it out.
  • Also verify that the cursor's Display is set to block or flex, not none.

​

Summary

​

To bring the cursor element above images in Webflow, set its position to fixed or absolute and assign it a high z-index like 9999. Confirm that overlapping elements have a lower z-index, and ensure the cursor isn't affected by hidden overflow or nesting issues.

Rate this answer

Other Webflow Questions