Html 如何删除两个div元素之间的空间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25132897/
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 02:26:10 来源:igfitidea点击:
How to remove space between two div element
提问by user1590595
I got two divs
我有两个 div
<div>abc</div>
<div>def</div>
with css as this
用 css 作为这个
div{
display:inline-block;
padding:0px;
margin:0px;
}
body{
padding:0px;
margin:0px;
}
how can i remove the gap/space between first and second div
如何消除第一个和第二个 div 之间的间隙/空间
link for the same http://cssdeck.com/labs/i5oysgmt
回答by Kheema Pandey
Remove the spacing at the code level.
删除代码级别的间距。
Write like this.
像这样写。
<div>abc</div><div>def</div>
回答by Lex Nguyen
div{
display:inline-block;
padding:0px;
margin-left:-4px;
}
回答by 4dgaurav
That is because of the white space in inline-block
elements
那是因为inline-block
元素中的空白
html
html
<div>abc</div><div>def</div>