CKTIS / CSS
CSS property `justify-content`
`justify-content` distributes free space between and around flex items or grid tracks on the main or inline axis.
Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ]justify-content distributes free space between and around flex items or grid tracks on the main or inline axis.
The example compares the first item position under start and center in a fixed-width flex container.
Grammar: normal | <content-distribution> | <overflow-position>? [ <content-position> | left | right ].
With no free space there is no displacement; this property does not replace justify-self, and overflow-safe alignment can fall back toward start.
Examples
<!doctype html><html lang="en"><meta charset="utf-8"><title>CKTIS CSS example</title><body><pre id="result"></pre><script>const g=document.createElement("div");g.innerHTML="<i></i><i></i>";document.body.prepend(g);g.style.cssText="display:flex;width:120px;height:40px";for(const x of g.children)x.style.cssText="width:20px;height:10px";const a=g.getBoundingClientRect();g.style.justifyContent="start";const x0=Math.round(g.firstElementChild.getBoundingClientRect().left-a.left);g.style.justifyContent="center";const x1=Math.round(g.firstElementChild.getBoundingClientRect().left-a.left);document.querySelector("#result").textContent="first-x="+x0+"->"+x1+"; computed="+getComputedStyle(g).justifyContent;</script></body></html>Result
first-x=0->40; computed=center
The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.