liveBook · Manning

Inline-block

As explained in Tiny CSS Projects

Inline-block is a CSS display value that keeps an element in inline flow while allowing block-like dimensions and spacing.

inline-block keeps an element in inline flow while allowing padding to affect its height. This makes it useful for links that need button-like spacing without leaving the line. section 5.4.2 section 8.2.6

Use inline-block when an inline element needs visible box styling:

  • Set display: inline-block on a call-to-action link before adding vertical padding. section 5.4.2
  • Change links from inline to inline-block when vertical padding makes them extend beyond a card. section 8.2.6

A padded card link

a { background-color: #ffa600; color: rgba(0, 0, 0, .75); padding: 0.75rem 1.5rem; display: inline-block; border-radius: 4px; text-decoration: none; } This preserves inline placement while making the padding contribute to the link's visible height.

How Tiny CSS Projects covers it

How deep it goes
Explains default inline behavior, demonstrates the height problem, and applies the display change without covering layout internals.
Examples
Demonstrates bright call-to-action links in hotel cards and padded controls in checkout-card sections.
What it assumes
Assumes basic CSS declarations and links while demonstrating inline elements, padding, and display changes directly.
What you can do after
Diagnose/debug with CSS when vertical padding fails to enlarge an inline link inside a card.
How it connects
Connects display values with inline flow, padding, element height, links, buttons, and inputs.

Also explained in

Compare how 4 books explain inline-block →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Tiny CSS Projects. The section links point to the parts of the book it draws on.