Html 在 div 之间应用空间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3511707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apply space between divs
提问by Hulk
The below two divs appear one next to other, the content of which are populated dynamically and the data is very long in both the divs.
下面两个div一个挨一个出现,里面的内容是动态填充的,两个div里面的数据都很长。
My question is that how to add some space between the two divs?
我的问题是如何在两个 div 之间添加一些空间?
<div name="qt" id="qt" style='width:50%;float:left;display:inline;overflow:auto;height:500px;border:1px solid #ccc;'> </div>
<div id="data" name="data" style='overflow:auto;width:35%;height:500px;margin-left:0px;border:1px solid #ccc;'></div>
回答by Sotiris
you can add on css #qt {margin-right:10px;}
你可以添加css #qt {margin-right:10px;}
you can change the number of pixels you wish.
你可以改变你想要的像素数。
回答by Bivas
change margin-left:0px
on the 2nd <div/>
to a greater value
改变margin-left:0px
二号<div/>
更大价值
回答by Dominic Rodger
Float the second div
left, and change its margin-left
to a non-zero value, e.g.:
div
向左浮动第二个,并将其更改margin-left
为非零值,例如:
<div name="qt" id="qt" style='width:50%;float:left;display:inline;overflow:auto;height:500px;border:1px solid #ccc;'> </div>
<div id="data" name="data" style='overflow:auto;width:35%;height:500px;margin-left:50px;border:1px solid #ccc; float: left;'></div>