topskill.dev
CoursesTracks
0
All courses/CSSPositioning Pickup Pin
Layout Fundamentals
5 / 10
← CSS
○CSS Rule Style an Exhibit Card○Write Your First CSS Rule○CSS Selectors Target Exhibit Details○Target Exhibit Details○Apply CSS Three Sources○Apply CSS Three Ways○Specificity Resolve a Style Conflict○Resolve Specificity○Inheritance and the cascade✦Module Quiz
○Color Palette○Color Palette○Background Layer○Background Layer○Type Rhythm○Type Rhythm○Borders and Shadows○Borders and Shadows✦Module Quiz
○Box Model Seed Packet Card○Space a Seed Packet○Display Swap Table Labels○Arrange Swap Table Labels●Positioning Pickup Pin○Pin the Pickup Location○Sizing and Overflow○Size a Seed-Swap Notice○Sticky scroll headings✦Module Quiz
○Advanced Selectors Book Cart Sign○Target a Book Cart Sign○Pseudo-Classes Night Cart States○Style Night Cart States○Pseudo-Elements○Add a Book-Quote Mark✦Module Quiz
○Lantern Market navigation○Lantern Market navigation✦Module Quiz
○Community garden request card○Community garden request card✦Module Quiz
○Flex Direction○Flex Direction○Main-Axis Spacing○Main-Axis Spacing○Cross-Axis Alignment○Cross-Axis Alignment○Wrapping and Flex Items○Wrapping and Flex Items○Flexbox Navigation○Flexbox Navigation✦Module Quiz
○Grid Tracks○Grid Tracks○Grid Gaps○Grid Gaps○Grid Placement○Grid Placement○Responsive Grid○Responsive Grid✦Module Quiz
○River radio schedule○Harbor radio schedule✦Module Quiz
○Field note color system○Field note color system○Transforms○Rotate a Field Note○Resilient styles✦Module Quiz
○Kite festival signal○Garden festival signal✦Module Quiz
○Garden forecast○Harbor forecast○Fluid sizing○Fluid weather bulletin○Images that fit✦Module Quiz
○Seed inventory table○Tool checkout table✦Module Quiz
○Community maker profile○Maker profile sheet✦Module Quiz

Positioning Pickup Pin

Attach a pin to the map card

The “Today” pin belongs in the library card's upper-right corner. Normal flow lays out block and inline boxes in document order. The default position is static: offsets such as top do not move that box. With relative positioning, offsets shift the painted box while its original space stays reserved. Absolute positioning lets this small label leave that flow and sit over the card instead.

.map-card { position: relative; } keeps the card in its normal place while making it a reference for its absolutely positioned child. .pickup-pin { position: absolute; } removes the pin's reserved space. The text no longer moves down to make room for it.

top: 12px and right: 12px place the pin's edges 12px from the card's inner border edges. Here the card is the nearest positioned ancestor and supplies the pin's containing block. Without that reference, the pin could appear away from the card.

Absolute positioning can overlap text because it reserves no space. The card's padding keeps the pin clear of the main heading here. Use it for a small corner label, not as a replacement for page-layout tools.

Move the pin

Run. Change right from 12px to 48px, then Run again: the pin moves left, farther from the right edge. Restore 12px. The heading does not move with it.

Hint 1
1 / 1
HINT 1

An absolutely positioned child uses the nearest positioned ancestor.

Files
  • ⋄index.html
  • ⋄style.css
Loading editor…