display:inline-block的两个div不在html中放一行会对页面产生影响

 1 <!DOCTYPE HTML>
 2 <html>
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 5 <title>无标题文档</title>
 6 <style>
 7     div{ display:inline-block; width:200px; height:200px; border:1px solid red;}
 8 </style>
 9 </head>
10 
11 <body>
12     <div></div>
13     <div></div>
14 </body>
15 </html>

我们发现,两个div display:inline-block之后,俩div 之间有间隙,并没有挨着,而这种原因是因为俩div之间的空格,解决这种bug的办法是,将两个div放在一起

posted on 2015-07-20 16:12  zhangjingyun  阅读(370)  评论(0编辑  收藏  举报