topskill.dev
CoursesTracks
0
All courses/CSSDisplay Swap Table Labels
Layout Fundamentals
3 / 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

Display Swap Table Labels

Choose how labels take up space

The seed-swap table needs labels that can share a line, a note beneath them, and a nonessential helper hidden from visitors. display controls the kind of box an element creates.

A normal block box starts a new line and uses the available width. An inline box sits in the text flow; ordinary width and height declarations do not size it like a block. inline-block keeps a single box in that flow while allowing block-like sizing. It can sit next to another label when there is room.

The .tag paragraphs use inline-block; their padding and colors are supplied. .swap-note uses block, already a paragraph's default. In the exercise the note is a span, so it will need that rule to start a new line.

display: none on .hidden-helper removes its box entirely and hides it from assistive technology. This helper is nonessential; never hide the only copy of instructions someone needs.

Compare the row

Run to see two labels together and the note below. Change .tag to display: block and Run: the labels stack. Restore inline-block. Temporarily remove the helper's display: none to reveal it, then undo that change.

Hint 1
1 / 1
HINT 1

Inline-block labels can have padding while still sharing a row.

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