flex布局四个div盒子前三个盒子左对齐,后面的盒子右对齐
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>flex布局</title>
    <style>
        *{
            margin: 0;   
            padding: 0;
        }
        .box {
	        display: flex;
	        justify-content: flex-start;
	    }
	
	    .block {
	        width: 100px;
	        height: 100px;
	        border:1px solid black;
	        
	    }
    </style>
</head>
<body>
<div class="box">
    <div class="block">块1</div>
    <div class="block">块2</div>
     // 此地margin-left:auto;自动填充了剩余空间
    <div class="block" style="margin-left: auto;">块3</div> 
    <div class="block">块4</div>
</div>
</body>
</html>
                    
                
                
            
        
浙公网安备 33010602011771号