Home
CSS
CSS Flexbox
Flex Items
Tryit: Four flex items inside a flex container
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> .flex-container { display: flex; background-color: #f1f1f1; } .flex-container > div { background-color: dodgerblue; color: white; width: 100px; margin: 10px; text-align: center; line-height: 75px; font-size: 30px; } </style> </head> <body> <h1>Flex Items</h1> <p>All direct children of a flex container becomes flex items:</p> <div class="flex-container"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> </body> </html>