flex-basis


<html>
<head>
    <style type="text/css">
        #main{
            border: 1px solid black;    
            width: 400px;
            height: 300px;
            display: flex;
        }
        #div1{
            width: 70px;
            height: 70px;
            background-color: pink;
            flex-basis:40px;
            }
        #div2{

            width: 70px;
            height: 70px;
            background-color: orange;
        }
        #div3{

            width: 70px;
            height: 70px;
            background-color: green;
        }
        #div4{
            width: 70px;
            height: 70px;
            background-color: yellow;
        }
    style>
head>
<body>
    <div id="main">
        <div id="div1">div>
        <div id="div2">div>
        <div id="div3">div>
        <div id="div4">div>
    div>
body>
html>

flex-basis_第1张图片
It will replace the div’s width.

你可能感兴趣的:(css)