html - CSS3 Flexbox spacing between items -


being new flexbox (although experienced in css), seems me 1 thing conveniently "glossed over" tutorials i've read spacing between flex items.

for example, 1 of cited tutorials this 1 @ css tricks.

it's , has been helpful, diagrams have thrown me off:

enter image description here

notice spaces between flex items. although not mentioned anywhere, nor in sample code, seem way spaces css margins.

correct, or missing important here?

because need create this, lot "center" demo above: enter image description here

however, when try myself, of course this: enter image description here

if use space-around, instead. huge space. enter image description here

therefore seems need add margin-right first 2 boxes 3 centered boxes small gap between them.

is bad use case flexbox? because see little advantage creating 3 boxes flexbox on using simple margins , centering.

am missing obvious here?

nope - you're not missing anything. flexbox terrific ordering elements , defining general alignment of elements along either main or cross axes, doesn't speak directly individual item spacing. if take @ codepen used in flexbox article, you'll notice use:

margin-top: 10px 

to define element spacing. hope helps!


Comments

  1. Free Download HTML5 Canvas API
    with Canvas Backgrounds. This HTML5 Canvas API is for those who want to add animations on their images and texts in the background like a slider.

    ReplyDelete

Post a Comment

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -