flexbox

PHOTO EMBED

Sun Nov 03 2024 12:32:50 GMT+0000 (Coordinated Universal Time)

Saved by @signup1

//flex.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flexbox Layout Example</title>
    <link rel="stylesheet" href="flexstyles.css">
</head>
<body>
    <div class="flex-container">
        <div class="flex-item">Item 1</div>
        <div class="flex-item">Item 2</div>
        <div class="flex-item">Item 3</div>
        <div class="flex-item">Item 4</div>
        <div class="flex-item">Item 5</div>
    </div>
</body>
</html>
//flexstyles.css
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
}

.flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background-color: #f4f4f4;
    padding: 20px;
}

.flex-item {
    background-color: #009688;
    color: white;
    padding: 20px;
    margin: 10px;
    flex: 1 1 30%; /* Grow, shrink, and set base width */
    text-align: center;
}
content_copyCOPY