liveBook · Manning

Place-content

As explained in Tiny CSS Projects

The CSS place-content property aligns and distributes a grid or flex container's content along its axes.

place-content controls how a grid or flex container aligns and distributes its content along its axes. In a custom radio button or checkbox, setting place-content: center centers the inner disk or check mark inside the input. section 10.3.3 section 10.3.5

Center a custom control’s inner box

Apply inline-grid to the input, then center its generated child with place-content: input[type="radio"], input[type="checkbox"] { width: 1.75em; height: 1.75em; display: inline-grid; place-content: center; } The input remains inline with its label while grid centers the smaller ::before box. section 10.3.3 section 10.3.5

Listing 10.10 Centering the inner box
:where(input[type="radio"], input[type="checkbox"])::before {
  display: block;
  content: '';
  width: 1em;
  height: 1em;
}

Inspect the generated inner box used with place-content: center; its block display and em-sized dimensions make the centered element visible once styled. section 10.3.5

How Tiny CSS Projects covers it

How deep it goes
Explains grid-based centering in inline-grid controls but does not detail other values or flex-container behavior.
Examples
Demonstrates centering a one-em generated inner box inside 1.75em radio and checkbox inputs.
What it assumes
Uses grid and inline-grid terminology while explaining that inline-grid retains grid features and stays in inline flow.
What you can do after
Apply it via CSS to center generated content inside inline-grid form controls.
How it connects
Connects place-content with CSS Grid, inline-grid, generated content, pseudo-elements, radio buttons, and checkboxes.

Also explained in

Compare how 2 books explain place-content →

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.