Skip to content
Astera Technology

Anchor an absolute note to its own panel

Identify the containing block that gives top and right offsets their reference.

The note is10px below the panel top and 10px inside its right edge.

Download complete case notes and answer keys ↓

Inspect the working example

The 240×120 panel is position:relative. The note is absolute with top 10 and right 10. The panel therefore establishes the containing block used by these offsets.

Inputs and native observations
CaseInput or inspectionResult and meaning
Top referencenote.top−panel.top10px
Right referencepanel.right−note.right10px
AncestorInspect panel positionrelative establishes the local containing block
Download editable CSV ↓

Follow the browser mechanism

Absolute positioning uses a qualifying containing-block ancestor. relative can establish that reference without removing the panel from normal flow. The note wraps and has a minimum rather than a fixed height so enlarged text remains readable.

Without the positioned ancestor the reference changes

The alternative removes position:relative from the panel. No other qualifying ancestor exists in this isolated source.

Counterexample source; inspect separately
<style>body{margin:8px}</style>
<style>.panel{width:240px;height:120px;background:#e3efe8}.note{position:absolute;top:10px;right:10px;margin:0;width:40px;overflow-wrap:anywhere}</style><section class="panel"><p class="note">Note</p></section>

The note uses the initial containing block, not the 240px panel; its right edge follows the viewport.

Try the repair

Does making the note absolute establish a local reference on its unpositioned parent automatically?

Show the worked answer

No. Check the qualifying ancestor. In this example, retain position:relative on the panel to establish that reference.

  • Measure offsets relative to the intended panel.
  • Test the missing-ancestor contrast at more than one width.

Original example files

Related resources