CKTIS / CSS
align-content — verdeling van de hele groep lijnen of sporen
`align-content` lijnt containerinhoud als groep uit langs kruis- of blokas wanneer vrije ruimte bestaat.
Versie: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>align-content lijnt containerinhoud als groep uit langs kruis- of blokas wanneer vrije ruimte bestaat.
Een flex met twee lijnen en space-between plaatst ze op 0/100px; center zet ze op 40/60px. Eénregelig nowrap blijft op 0px, dus zonder effect.
Grammatica: normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position>.
normal werkt meestal als stretch in flex en grid, maar als start in gewoon block; ook multicol valt eronder. space-between, space-around en space-evenly verdelen overschot; posities en baselines pakken de groep. safe en unsafe zijn momenteel at-risk in Box Alignment 3. De eigenschap erft niet en animeert als discrete.
Voorbeelden
const make=(wrap,align)=>{const box=document.createElement('div');box.style.cssText='display:flex;flex-wrap:'+wrap+';align-content:'+align+';align-items:flex-start;width:120px;height:120px';for(let i=0;i<4;i++){const item=document.createElement('div');item.style.cssText='flex:0 0 60px;height:20px';box.append(item)}document.body.append(box);return box};
const positions=box=>[...box.children].map(item=>item.offsetTop-box.offsetTop);
const multi=make('wrap','space-between');const between=positions(multi);multi.style.alignContent='center';const center=positions(multi);
const single=make('nowrap','center');const nowrap=positions(single);
console.log('between='+between[0]+'/'+between[2]+'; center='+center[0]+'/'+center[2]+'; nowrap='+nowrap[0]+'; computed='+getComputedStyle(multi).alignContent);Resultaat
between=0/100; center=40/60; nowrap=0; computed=center
`align-content` lijnt containerinhoud als groep uit langs kruis- of blokas wanneer vrije ruimte bestaat.