Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 3966
Alex Hales
  • 0
Alex HalesTeacher
Asked: June 3, 20222022-06-03T07:22:28+00:00 2022-06-03T07:22:28+00:00

javascript – How to prevent overlap between elements of different z-index positions across several layers?

  • 0

[ad_1]

I understand in general we place individual elements one on top of the other with different positions, many times to give an illusion of two or more elements that are separated to look like a single component. But, is there a property in CSS that could make a higher position element prevent all the other elements behind it to display the overlap and just between a specific depth range?

Just to give more context here, I’m making a dynamic pie, each element is independent, including the center. The page has a lot of dynamism, water effects on the background, fog at the top, background picture, etc. Everything has different depths, but among all of them, I want to remain the center of the pie “untouched” by everything displayed at the back of it, while keeping a transparent background. One thing I’ve been struggling with a lot is removing the background color when hovering over a pie-children.

As you can see in the attached picture, the center of the pie and all individual children have a transparent background. The center of the pie has a higher z-index than the children, hence when a child is hovered its background overlaps with the center of the pie. I have applied a transparent background gradient to the pie children to remove the overlap, but because it’s a dynamic pie it only works for a 4 element pie. When the pie has less or more than 4 elements, the angle of the background gradient becomes disproportional.

Please consider the background gradient is just one example, I also want to display a box-shadow in each child. The box-shadow, as well as the background color, need to be removed from the center of the pie, but the water effect happening on top of the background picture needs to continue running.

Fiddle -> https://jsfiddle.net/jsandler/u34r8x9d/25/

Pie children CSS

.pie-children:hover {
    /* box-shadow: 0px 0px 30px 10px rgba(255, 255, 255, 0.2) inset, 0px 0px 30px 10px rgba(255, 255, 255, 0.2); */
    background-color: rgba(255, 255, 255, .15);
    backdrop-filter: blur(5px);
    text-shadow: 0px 0px 5px rgba(255, 255, 255, 0.8);
    /* background-image: radial-gradient(farthest-corner at 0% 100%, transparent 0 25%, rgba(255, 255, 255, .15) 25% 100%); */
    cursor: pointer;
}

enter image description here

[ad_2]

  • 0 0 Answers
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 8143 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 1926 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 1960 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.