A Complete Guide to Flexbox Layout: Achieving Flexible and Adaptive Web Page Arrangement

Flexbox (Flexbox)

        Flexbox (Flexbox) is a CSS layout model designed to provide flexible and adaptive arrangements for web pages. It enables page elements to be arranged and distributed within a container in a predictable manner by defining the behavior of the container and the items within it.

Use of flexbox

Declare it as flexbox by setting the container's displayproperty to flexor :inline-flex

<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹性盒</title>

    <style>
        #box {
            width: 600px;
            height: 150px;
            border: 3px solid black;
            display: flex;
        }

        #box div {
            width: 100px;
            height: 100px;
            border: 1px dashed red;
        }
    </style>

</head>

<body>

    <div id="box">
        <div>1</div>
        <

Guess you like

Origin blog.csdn.net/a451319296/article/details/131275724