Css 水平对齐两个不同高度的div,并在各自的列中保持环绕

Css 水平对齐两个不同高度的div,并在各自的列中保持环绕,css,Css,我需要将两个div浮动在一起,以便它们水平对齐。如果右边的div更高,它不应该在下面,而是应该在自己下面 <html> <style> #left, #right {float:left; border:1px solid black; margin:10px;} </style> <div id="container"> <div id="left"> this is an image, the hight and width

我需要将两个div浮动在一起,以便它们水平对齐。如果右边的div更高,它不应该在下面,而是应该在自己下面

<html>

<style>
#left, #right {float:left; border:1px solid black; margin:10px;}
</style>

<div id="container">

<div id="left">
this is an image, the hight and width can vary
</div>
<div id="right">
this div should never wrap underneath the image.  if it is higher than left image it needs to wrap under itself so the space directly beneath the image is respected
</div>

</div>
<div style='clear:both;'></div>

<hr>

<div id="left">
this is an image, the hight and width can vary
</div>
<div id="right">
this div should never wrap underneath the image.  if it is higher than left image it needs to wrap under itself so the space directly beneath the image is respected
</div>

</div>
<div style='clear:both;'></div>
</html> 

#左,#右{浮点:左;边框:1px纯黑色;边距:10px;}
这是一幅图像,其高度和宽度可能会有所不同
此div永远不应包裹在图像下方。如果它高于左图像,则需要将其包裹在自身下方,以便尊重图像正下方的空间

这是一幅图像,其高度和宽度可能会有所不同 此div永远不应包裹在图像下方。如果它高于左图像,则需要将其包裹在自身下方,以便尊重图像正下方的空间
#left, #right {float:left; border:1px solid black; margin:10px; width:45%;}