div漂浮在旋转木马顶部的问题

时间:2013-11-28 23:57:20

标签: javascript css

我正在使用jCarousel,我的页面上有一个奇怪的错误,我无法弄明白!基本上,我正试图在我的轮播上叠加<div>

当我将<div>置于顶部时,这个奇怪的间隙会在旋转木马顶部弹出!我不知道它来自哪里。它在JavaScript吗?

黑匣子,我可以稍后格式化。只需要知道白色空间出现的原因。

JsFiddle from the bug

HTML

<div class="carousel-wrapper">
    <div class="jcarousel-wrapper">
        <div class="jcarousel">
            <ul>
                <li>
                    <img src="http://placekitten.com/850/500" width="850" height="500" alt="">
                </li>
                <li>
                    <img src="http://placekitten.com/850/500" width="850" height="500" alt="">
                </li>
                <li>
                    <img src="http://placekitten.com/850/500" width="850" height="500" alt="">
                </li>
            </ul>
        </div>
        <a href="#" class="jcarousel-control-prev">&lsaquo;</a>
        <a href="#" class="jcarousel-control-next">&rsaquo;</a>
        <p class="jcarousel-pagination"></p>
    </div>
</div>

CSS

#login-carousel-wrapper {
    width: 850px;
    height: 500px;
    margin: 0px auto;
}
    #login-carousel-area {
    background-color: #000;
    z-index: 999;
    width: 200px;
    height: 200px;
    position: relative;
    top: 200px;
    left: 100px;
}
#body-wrapper {
    width: 970px;
    height: 100%;
    margin: 0px auto;
    text-align: top;
}
.carousel-wrapper {
    max-width: 850px;
    /*padding: 0 20px 40px 20px;*/
    margin: auto;
}
.jcarousel-wrapper {
    margin: 20px auto;
    position: relative;
    border: 10px solid #fff;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    -webkit-box-shadow: 0 0 2px #999;
    -moz-box-shadow: 0 0 2px #999;
    box-shadow: 0 0 2px #999;
}
.jcarousel-wrapper .photo-credits {
    position: absolute;
    right: 15px;
    bottom: 0;
    font-size: 13px;
    color: #fff;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.85);
    opacity: .66;
}
.jcarousel-wrapper .photo-credits a {
    color: #fff;
}
/** Carousel **/
 .jcarousel {
    position: relative;
    overflow: hidden;
    width: 850px;
    height: 500px;
}
.jcarousel ul {
    width: 20000em;
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}
.jcarousel li {
    float: left;
}
/** Carousel Controls **/
     .jcarousel-control-prev, .jcarousel-control-next {
    position: absolute;
    top: 200px;
    width: 30px;
    height: 30px;
    text-align: center;
    background: #4E443C;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 0 1px #000;
    font: 24px/27px Arial, sans-serif;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
    -webkit-box-shadow: 0 0 2px #999;
    -moz-box-shadow: 0 0 2px #999;
    box-shadow: 0 0 2px #999;
}
.jcarousel-control-prev {
    left: -50px;
}
.jcarousel-control-next {
    right: -50px;
}
.jcarousel-control-prev:hover span, .jcarousel-control-next:hover span {
    display: block;
}
.jcarousel-control-prev.inactive, .jcarousel-control-next.inactive {
    opacity: .5;
    cursor: default;
}
/** Carousel Pagination **/
 .jcarousel-pagination {
    position: absolute;
    bottom: 0;
    left: 15px;
}
.jcarousel-pagination a {
    text-decoration: none;
    display: inline-block;
    font-size: 11px;
    line-height: 14px;
    min-width: 14px;
    background: #fff;
    color: #4E443C;
    border-radius: 14px;
    padding: 3px;
    text-align: center;
    margin-right: 2px;
    opacity: .75;
}
.jcarousel-pagination a.active {
    background: #4E443C;
    color: #fff;
    opacity: 1;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75);
}

1 个答案:

答案 0 :(得分:0)

Live Demo

如果您在谈论顶部的20px白线,那就来自.jcarousel-wrapper的{​​{1}}。

如果您想保留最低保证金,只需将margin: 20px auto;更改为20px或添加新行覆盖0px

margin-top