How do I fix this CSS problem in modal dialog: An absolutely positioned badge is moving relative to the page instead of its card.?

CSS Published Updated 0 Views Verified
Problem: An absolutely positioned badge is moving relative to the page instead of its card. Context: This CSS troubleshooting question uses a modal dialog example. Correct approach: Make the card a positioned ancestor. Working CSS: .card { position:relative; } .badge { position:absolute; top:10px; right:10px; }
Looking for the latest Sarkari Result 2026 updates? Check the latest government exam results, merit lists and result updates on Sarkari Resultess.
Sarkari Resultess
Questions & Answers

Answer & Explanation

4 Answers
Verified Correct Answer

A. Correct CSS solution

.card { position:relative; } .badge { position:absolute; top:10px; right:10px; }
Additional Explanation
Make the card a positioned ancestor.
Sarkari Resultess
Editorial Answer 1
Verified

B. Common but incorrect approach

Set position:static on the card
Additional Explanation
This approach does not directly implement the required CSS behavior.
Sarkari Resultess
Editorial Answer 2
Verified

C. Incorrect CSS alternative

Set float:right on the badge
Additional Explanation
This is not a valid CSS property or does not solve the stated problem.
Sarkari Resultess
Editorial Answer 3
Verified

D. Another incorrect approach

Set display:inline-block on the card
Additional Explanation
This does not address the underlying CSS layout or styling issue.
Sarkari Resultess
Editorial Answer 4