Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何将两个动态大小的块并排堆叠?_Html_Css - Fatal编程技术网

Html 如何将两个动态大小的块并排堆叠?

Html 如何将两个动态大小的块并排堆叠?,html,css,Html,Css,如果我有两个具有动态宽度/高度的块,有没有办法在固定宽度的父元素内将它们对齐 见: 我希望蓝色/动态div始终根据红色元素的大小调整大小,并且不要位于红色下方。换句话说,蓝色方块是一个方形方块,它位于红色方块的旁边 .wrap {width:600px; }/*static*/ .something {float:left; background:red; width:200px; height:100px;} /*dynamic width/height*/ .somethingelse {

如果我有两个具有动态宽度/高度的块,有没有办法在固定宽度的父元素内将它们对齐

见:

我希望蓝色/动态div始终根据红色元素的大小调整大小,并且不要位于红色下方。换句话说,蓝色方块是一个方形方块,它位于红色方块的旁边

.wrap {width:600px; }/*static*/
.something {float:left; background:red; width:200px; height:100px;} /*dynamic width/height*/

.somethingelse { background:blue;} /*dynamic width/height and should always be next to .something*/

谢谢

通过使用
display:table
display:table cell
,您应该能够实现您想要的:

.wrap {width:600px; display:table; }/*static*/
.something {display:table-cell; background:red; width:200px; height:100px;} 
.somethingelse { background:blue; display:table-cell;}