Solving the webkit overlap issue with a clever workaround

After spending several months working on a page, I noticed an unusual behavior in webkit-based browsers. I had implemented an input element using a technique I inquired about here Create quadrilateral with specific degree. Everything was functioning well in all browsers except for webkit.

I researched this particular issue and attempted to discover existing workarounds. One suggested fix looked like this:

@supports (-webkit-overflow-scrolling: touch) {
    transform: translate3d(0, 0, 0);
}

Unfortunately, this approach did not resolve the problem.

To showcase the glitch, I created a project available at:

In addition, I developed a simpler example:

<div>
    <div class="wrapper">
        <div class="background"></div>
        <div class="content">
            <h1>
                Test
            </h1>
            <h1>
                Test
            </h1>
            <h1>
                Test
            </h1>
            <h1>Test</h1>
        </div>
    </div>
</div>
<style>
.background {
    position: absolute;
    transform: rotateX(58.6297041833deg) rotate(45deg);
    background-color: green;
    top: 96.619312px;
    left: 3.4641016151px;
    transform-origin: right top;
    border-radius: 100px;
    width: 500px;
    height: 500px;
}

.wrapper {
    position: releative;
}

.content {
    position: relative;
}
</style>

This is how it appears in most browsers:

And here is how it looks in webkit-based browsers:

At this point, I am actively seeking a workaround for this issue as I do not anticipate a quick resolution. It's unclear whether this is a webkit bug or a flaw in my CSS code, but given that it works fine in every other browser, I suspect it may be a webkit issue.

I came across a WebKit Bug Report that might shed some light:

Answer №1

Initially, I recommend avoiding h1 tags for those purposes as it could negatively impact search engine optimization. :)

It seems like the issue may be related to the content class. Have you tried using min-height?

CSS Code

.content {
    min-height:300px; /* try this out */
}

If not, providing a JS fiddle or similar would be helpful in diagnosing the problem :)

Answer №2

After some experimentation, I stumbled upon a solution on my own. It dawned on me one day that perhaps webkit has a different starting z position. Curious, I decided to move the div away and lo and behold, it worked like a charm.

To resolve this bug, try applying translateZ first in your transformation:

.background {
    position: absolute;
    transform: rotateX(58.6297041833deg) rotate(45deg);
    -webkit-transform: translateZ(-1000px) rotateX(58.6297041833deg) rotate(45deg);
    background-color: green;
    top: 96.619312px;
    left: 3.4641016151px;
    transform-origin: right top;
    border-radius: 100px;
    width: 500px;
    height: 500px;
}

.wrapper {
    position: releative;
}

.content {
    position: relative;
}

Note the translateZ(-1000px) on -webkit-transform

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

Achieving Clear Table Borders with CSS

Does anyone have any suggestions on how to achieve a table design similar to the one marked with red circles, without using borders or background colors? ...

Using Angular to Bind Checkbox Value in Typescript

I have a challenge of creating a quiz where a card is displayed with 4 questions structured like this: <div class="col-md-6"> <div class="option" id="Answer1"> <label class="Answer1"> <input value= "Answer1" type="checkbox ...

Using an HTML input element within an ion-checkbox component

I've been attempting to place an html input next to an ion checkbox, but I'm running into issues. <label> <ion-checkbox ng-model="mode" ng-checked="checked"> <input type="text"> </ion-checkbox> </label& ...

Tips for assigning a random numerical value to each cell

I am struggling to assign each cell a random double-digit number between 50 and 500. I have been attempting to use the Math.floor(Math.random()) function but have not had any success so far. Additionally, I am trying to figure out how to target only one c ...

The clash between the position:fixed and overflow:visible styles in CSS

I'm working on a webpage layout that includes an image positioned on the right side of the page. I want to create horizontal scroll bars when the browser window is resized, so I added the overflow: visible property. Additionally, I want the image to b ...

Tips for aligning an image vertically within a list item

I am having trouble aligning my image vertically in the li tag. This is what I currently have: <nav id='tabs-wrapper'> <ul id='tabs'> <li><a href='index.html'><img id='btn' src=&apo ...

Sliding into a New Page with jQuery Mobile's Transition Effects

Whenever I transition between pages using a slide effect, the new page resizes before the transition from the previous page is complete. This makes the application appear glitchy. Is there a way to prevent this automatic resizing or auto height calculatio ...

Showing a numerical value in the bottom-right corner alongside a backdrop of an image

I am attempting to create a container that measures 26x26 pixels and showcases a number at the bottom right corner of this container. Furthermore, I want to include a 24x24 picture as the background of the container. The code I have written so far is disp ...

Looking to turn off animation for a WordPress theme element?

Is there a code that I can insert into the style.css file to deactivate the theme animations on my WordPress page? As users scroll down, each element either drops in or slides in. I recently purchased the WP Alchemy theme from , but the animation speed is ...

My Bootstrap navbar seems to be malfunctioning. I'm wondering if there could be an issue with

here is a snippet of the code I'm working on: <nav class="navbar navbar-expand-md navbar-dark bg-dark sticky-top"> <div class="container-fluid"> <a class="navbar-brand" href="#"> <img src="https://i.stack.imgur.com/5XeYV.png" ...

Authentication using a singular input

Struggling to design an input for a verification code with just one input instead of four. However, I am facing some challenges: The input is not responding correctly when clicked, it's a bit buggy and requires clicking at the end of the input to typ ...

The dropdown height feature is experiencing issues in the Chrome browser

3 radio buttons and a single select box are displayed on the page. When clicking on the first radio button, the select box should show contents related to the first radio button. However, when selecting the second or third radio buttons, the select box hei ...

Is there a way to adjust the alignment of the placeholder text to the top of a sizable input field?

Here is how my code currently appears: https://i.sstatic.net/WwXd2.png I am trying to align the text at the top of the input text field. I have attempted using align-text-top, align-top, and creating a custom class with vertical-align: top; and vertical ...

My confusion is running high when it comes to navigating the mobile version of my website

Creating a navigation bar for my website has been challenging. Whenever I switch to mobile view, the list in my navigation bar shifts 40px to the right side of the screen where there's nothing. Is there any way you can assist me with this issue? ...

Utilizing the optimal method for aligning text to either the right or left side

I am currently working on creating a container element with multiple child elements. I would like these elements to be aligned differently, some left-aligned and others right-aligned. This includes scenarios where the child elements themselves are containe ...

Positioning a button in the top right corner with Bootstrap 4

For a header design, I need to position the language selector in the top right corner and have a logo image on the left side. Below these elements, there should be a row of links that spans the entire width. Normally, this setup would work fine, but when ...

Make the div disappear after a specified time

Does anyone know of a code snippet that can make a couple of div elements fade out after a specific time period? Currently, I have the following example: <div id="CoverPop-cover" class="splash"> <div id="CoverPop-content" class="splash-center"> ...

Truncate text on a dynamic button positioned above a fluid container

Looking for a CSS-only solution to manage text within an image-defined box? The challenge is to place a button in the center if the text is shorter than the image, or cut it with ellipsis if longer. Also, the text should not exceed the box width. Any ideas ...

The elements in the navigation bar stay in view for a short period of time even after the collapsible navbar has been

After collapsing the navbar, the navbar items remain visible for a short period of time, as shown in the second image below. Here is the HTML code: <nav class="navbar navbar-dark fixed-top" style="background-color: transparent;> <a class="navb ...

Trouble with applying position absolute to pseudo element in Firefox version 12 and higher

I seem to be running into an issue with the positioning of a pseudo element in Firefox version 12 or higher (possibly even earlier versions). Despite having position:relative on the anchor tag, the element appears to be relative to the entire page. Any ide ...