codegurukool.com · Free coding tutorials & online compiler

Home › CSS Tutorial › Flex container

Flex container

Properties set on the parent.

flex-direction, flex-wrap, justify-content, align-items, align-content, gap.

Example code

<style>
.f{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;align-items:flex-start;gap:8px;height:130px;background:#eee}
.f div{background:#2e86de;color:#fff;padding:12px}
</style>
<div class='f'><div>1</div><div>2</div><div>3</div></div>

Run this code in the online editor

← CSS variablesFlex items →