css The height of the left side is adaptive, keeping the height consistent with the height of the right side

1. Rendering

insert image description here

Achievement effect: the height of the red area on the left is uncertain, and it follows the height change of the blue area on the right to adapt

2. Implementation method

2.1 Use css positioning

<div class="content">
	<div class="left">左边</div>
	<div class="right">右边</div>
</div>
.content {
    
    
	position: relative;
	.left {
    
    
		width: 100px;
		height: 100%;
		position: absolute;
	}
	.right {
    
    
		width: 500px;
		height: 100%;
		margin-right: 124px;
	}
}

Guess you like

Origin blog.csdn.net/DarlingYL/article/details/130615238