My challenge is to create a circular div
element that is wider than the mobile screen and perfectly centered. This circular div
needs to be an exact circle, specifically targeted for mobile screens.
I've attempted to achieve this using the code in this JSFiddle, but I'm struggling to extend the width beyond the screen width.
To handle this issue, my approach involves calculating the width of the div
based on its height if the height exceeds the screen width. Otherwise, the width should have a minimum value greater than the current screen width.
In search of a solution, I am looking for a pure JavaScript
method without incorporating jQuery. Although this question bears resemblance to others found on Stack Overflow like this one and that one, I specifically require the #circle
element to exceed the screen width while utilizing position: absolute
. Implementing position: absolute
, as suggested in one of the answers provided, could cause complications that I'd prefer to avoid.