-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Description
Summary
When an element has no size (in my example, no content + inline positioning), it is positioned based on the viewport offset rather than its parent element.
Operating system
macOS
Steps to reproduce
Minimal snippet to reproduce the bug
<style>
span {
position: relative;
}
span::before {
content: "c";
position: absolute;
top: 0;
left: 0;
}
</style>
a<span></span>b a<span> </span>bThe first span has no content and is zero size; the second has a space, making it non-zero-sized.
Expected behavior
The ::before element should be positioned based on its parent element, even when the parent has zero size.
Chrome places it where the element is

Actual behavior
The ::before element is placed at the viewport origin when the parent has zero size.
Ladybird places it at the viewport origin

URL for a reduced test case
HTML/SVG/etc. source for a reduced test case
N/ALog output and (if possible) backtrace
N/AScreenshots or screen recordings
No response
Build flags or config settings
No response
Contribute a patch?
- I’ll contribute a patch for this myself.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels