Is there a way to achieve this using only CSS, without needing JavaScript? I am working on a project with a lot of relative and absolute positions, where elements must be centered dynamically without specifying static widths. While I have managed to minimize display errors using CSS alone, it would be ideal if CSS had built-in functionality for this kind of positioning.
Current SASS code:
element
position: absolute;
top: 100px;
right: 50%;
margin-right: -50px; /* static width in %/px/em/rem/... */
Possible solution:
element
position: absolute;
top: 100px;
right: calc(50% - this.width / 2);
Is there any existing method to achieve this behavior in CSS currently? If not, are there plans to implement it in future releases?