简体   繁体   English

我的列之间的白色间距无法使用CSS覆盖它,也看不到它上面的CSS显示空格

[英]white spacing between my columns can't overwrite it using css and can't see the css on it showing space

I have a set of columns with some sliding i am doing between them but then when i arranged them to look like how in my fiddle i found a space between each of them 我有一组在它们之间滑动的圆柱,但是当我将它们排列成看起来像在小提琴中时,我发现它们之间有一个间隔

在此处输入图片说明

This is my fiddle , how I can get rid of this spacing to make them attached to each others? 这是我的小提琴 ,如何摆脱这种距离,使它们彼此依附?

 $(document).ready(function() { jQuery("#switcher1").click(function() { jQuery(".middle-wrap").animate({left: "0px"}); }); jQuery("#switcher2").click(function() { jQuery(".middle-wrap").animate({left: "-198.4px"}); }); jQuery("#switcher3").click(function() { jQuery(".middle-wrap").animate({left: "-396.8px"}); }); jQuery("#switcher4").click(function() { jQuery(".middle-wrap").animate({left: "-595.2px"}); }); jQuery("#switcher5").click(function() { jQuery(".middle-wrap").animate({left: "-793.6px"}); }); jQuery("#switcher6").click(function() { jQuery(".middle-wrap").animate({left: "-992px"}); }); jQuery("#switcher7").click(function() { jQuery(".middle-wrap").animate({left: "-1190.4px"}); }); jQuery("#switcher8").click(function() { jQuery(".middle-wrap").animate({left: "-1388.8px"}); }); }); 
 .outer-wrap { overflow-x: hidden; position: relative; max-width: 1050px; min-width: 1050px; margin: 0; padding: 0; height: 450px; background-color: #fff; -webkit-border-radius: 5px; border-radius: 5px; border: 1px solid #e3e3e3; display: inline-block; background-color: #fff; border-top: 1px solid #e3e3e3; transition: all 50ms ease-in-out; } .middle-wrap { position: relative; max-width: 1890px; left: 0px; margin: 0; padding: 0; height: 450px; min-width: 1890px; } .inner-wrap { display: inline-block; max-width: 210px; min-width: 210px; border-right: 1px solid #e3e3e3; vertical-align: top; border: none; margin: 0; padding: 0; height: 100%; /* float: left;*/ } .year_list { background-color: darksalmon; } .make_list { background-color: red; } .model_list { background-color: aquamarine; } .body_style { background-color: blue; } .transmission { background-color:darkviolet; } .options { background-color: darkslategray; } .aftermarket_modifications { background-color: darkseagreen; } .mileage { background-color: darkred; } .license_plate { background-color: darkorange; } 
 <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> <div id="switcher1">See Part 1</div> <div id="switcher2">See Part 2</div> <div id="switcher3">See Part 3</div> <div id="switcher4">See Part 4</div> <div id="switcher5">See Part 5</div> <div id="switcher6">See Part 6</div> <div id="switcher7">See Part 7</div> <div id="switcher8">See Part 8</div> <div class="outer-wrap"> <div class="middle-wrap"> <div class="inner-wrap year_list"></div> <div class="inner-wrap make_list"></div> <div class="inner-wrap model_list"></div> <div class="inner-wrap body_style"></div> <div class="inner-wrap transmission"></div> <div class="inner-wrap options"></div> <div class="inner-wrap aftermarket_modifications"></div> <div class="inner-wrap mileage"></div> </div> </div> 

Due to your display: inline-blocks , the white spaces appear in between your block elements. 由于您的display: inline-blocks ,空格出现在您的图块元素之间。

There are many resolutions to the same, refer to David Walsh's blog 相同的解决方法很多,请参考David Walsh的博客

What I would prefer to do here is use float instead of display: inline-block . 我在这里更喜欢使用float而不是display: inline-block

Check updated fiddle: https://jsfiddle.net/b6fw4u0z/2/ 检查更新的小提琴: https : //jsfiddle.net/b6fw4u0z/2/

Uncomment float: left in .inner-wrap styling 取消注释float: left.inner-wrap样式

jsfiddle jsfiddle

If you have to use display: inline-block then to remove the white space between elements, you can set 如果必须使用display:inline-block然后删除元素之间的空白,可以设置

font-size: 0 

to them. 给他们。

See updated fiddle: https://jsfiddle.net/b6fw4u0z/3/ 查看更新的小提琴: https : //jsfiddle.net/b6fw4u0z/3/

You will notice i just put it on all the nested divs. 您会注意到我只是将其放在所有嵌套的div上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM