.inner) [31,21 102x102]
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/abspos-only-with-inset-left.html b/Tests/LibWeb/Layout/input/block-and-inline/abspos-only-with-inset-left.html
new file mode 100644
index 0000000000..4c997d6d11
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/abspos-only-with-inset-left.html
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/abspos-with-bottom-right-insets-relative-to-box-with-paddings.html b/Tests/LibWeb/Layout/input/block-and-inline/abspos-with-bottom-right-insets-relative-to-box-with-paddings.html
new file mode 100644
index 0000000000..0ac1398a80
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/abspos-with-bottom-right-insets-relative-to-box-with-paddings.html
@@ -0,0 +1,22 @@
+
\ No newline at end of file
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/abspos-without-insets-relative-top-box-with-padding-top.html b/Tests/LibWeb/Layout/input/block-and-inline/abspos-without-insets-relative-top-box-with-padding-top.html
new file mode 100644
index 0000000000..4b0eda5895
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/abspos-without-insets-relative-top-box-with-padding-top.html
@@ -0,0 +1,15 @@
+
+
\ No newline at end of file
diff --git a/Tests/LibWeb/Layout/input/block-and-inline/abspos-without-insets.html b/Tests/LibWeb/Layout/input/block-and-inline/abspos-without-insets.html
new file mode 100644
index 0000000000..b7c3934506
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/block-and-inline/abspos-without-insets.html
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index cebfe0740d..9b9137abbe 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -1123,7 +1123,12 @@ void FormattingContext::layout_absolutely_positioned_element(Box const& box, Ava
used_offset.set_x(box_state.inset_left + box_state.margin_box_left());
used_offset.set_y(box_state.inset_top + box_state.margin_box_top());
// NOTE: Absolutely positioned boxes are relative to the *padding edge* of the containing block.
- used_offset.translate_by(-containing_block_state.padding_left, -containing_block_state.padding_top);
+ // Padding offset only need to be compensated when top/left/bottom/right is not auto because otherwise
+ // the box is positioned at the static position of the containing block.
+ if (!box.computed_values().inset().top().is_auto() || !box.computed_values().inset().bottom().is_auto())
+ used_offset.translate_by(0, -containing_block_state.padding_top);
+ if (!box.computed_values().inset().left().is_auto() || !box.computed_values().inset().right().is_auto())
+ used_offset.translate_by(-containing_block_state.padding_left, 0);
box_state.set_content_offset(used_offset);
if (independent_formatting_context)