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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:11:30  来源:igfitidea点击:

Apply space between divs

htmlcss

提问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:0pxon the 2nd <div/>to a greater value

改变margin-left:0px二号<div/>更大价值

回答by Dominic Rodger

Float the second divleft, and change its margin-leftto 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>