简体   繁体   English

CSS删除标题和jQuery滑块之间的空白

[英]CSS remove white space in between header and jQuery slider

I am a designing a website where I would like the header to have a height of 100px and a jQuery slider beneath it. 我正在设计一个网站,我希望标头的高度为100px,并在其下方使用jQuery滑块 I have decided to use the Jssor Slider since I like the way it performs. 我决定使用Jssor Slider,因为我喜欢它的执行方式。 When I run my site, as I increase the width of the browser window, the slider container is increasing the amount of white space below the header. 当我运行网站时,随着我增加浏览器窗口的宽度,滑块容器也增加了标题下的空白空间。

I'm not really sure why this is occurring and I have tried playing around with the CSS by putting in white-space:nowrap & display:inline-block within the slider container itself but that's still not working. 我不太确定为什么会这样,并且我尝试通过在滑块容器本身中放入空白:nowrapdisplay:inline-block来玩CSS,但这仍然无法正常工作。

HTML: HTML:

<header>
<!-- Header elements inside here -->
</header>

<!--Begin Jssor Slider -->

<div id="slider1_container" style="position: relative; margin: 0 auto;
    top: 0px; left: 0px; width: 1300px; height: 600px; overflow: hidden;white-space:nowrap;display:inline-block;">


    <div u="slides" style="cursor: move; position: absolute; left: 0px; top: 150px; width: 1300px;
        height: 600px; overflow: hidden;">
<!--Additional Slider divs for containing pictures, arrows, etc. -->
    </div>
</div>

CSS: CSS:

header {
    background: #FFF;
    height:100px;
    position:fixed;
    z-index:100;
    width:100%;
}

Any help would be greatly appreciated! 任何帮助将不胜感激! Thank you. 谢谢。

UPDATE UPDATE

I just realized that you used display:inline-block; 我只是意识到您使用了display:inline-block; ,this is what is causing your margin, you can either remove it, change it to display:table; ,这就是造成您的保证金的原因,您可以删除它,或者将其更改为display:table; or give a negative margin of -4px that will eliminate the blank space in between. 或提供-4px的负边距,以消除两者之间的空白。 You may need to adjust that negative margin according to your need but it will do the trick. 您可能需要根据需要调整该负边距,但这可以解决问题。

You can find more about Fighting the Space Between Inline Block Elements HERE 您可以在此处找到更多有关在行内块元素之间进行战斗的信息

It looks like your slider is absolutely positioned. 看起来您的滑块已完全定位。 Why not decrease the top attribute to something like top:100px; 为什么不将top属性减小为top:100px; ? You can decrease/increase it to your liking. 您可以根据自己的喜好减少/增加它。

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

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