假设一个div里面有很多div:
<div id="#container">
div div div div
</div>
内部的 div 甚至可以相邻。现在我想在所有这些之间有 5px 的填充,就像 table
的 cellspacing
一样。
最佳答案
你会做这样的事情:
#container div
{
margin: 0px 5px 5px 0px;
}
或仅针对直系 child :
#container > div
{
margin: 0px 5px 5px 0px;
}
如果你想让 div 并排放置,你必须让它们 float :
#container div
{
float:left;
clear:none;
margin: 0px 5px 5px 0px;
}
关于html - 在 div 中,如何设置 "cell spacing"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11721889/