我希望您能启发我如何将这两个div(或跨度)(如果需要的话)放入另一个div。我需要内部两个div的大小是较大容器的一定百分比。他们还需要彼此相邻。我已经在Web和stackoverflow上尝试了许多不同的解决方案,但似乎仍然无法使其工作。有人可以帮忙吗?下面是代码段,我还提供了一个小提琴,以便您可以更好地看到。
body {
background-color:#f2f2f2;
}
#content {
border:solid;
height:500px;
width:500px;
}
.results {
width:50%;
height:70%;
border: solid;
/*overflow:scroll;overflow-x:hidden;*/
margin-left:7%;
margin-top:5%;
margin-bottom:8%;
}
.map {
width:25%;
height:70%;
border: dotted;
margin-top:5%;
margin-bottom:8%;
float:right;
}
<body>
<div id="content">
<div class="results"></div>
<div class="map"></div>
</div>
</body>
Here is the Fiddle for the above code
感谢大家的帮助!我希望我的问题足够清楚。
最佳答案
我相信display:inline-block
是您想要的。
将其放在.results
中,并用它替换float:right
中的.map
。
Here is the updated jsFiddle
关于css - 如何在另一个<div>中包含这两个<div>?当我将它们设为<span>时,它不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17644448/