为什么我的幻灯片不能正常工作?

时间:2016-11-26 03:23:31

标签: html css

因此,对于我正在建设的网站,我想在主页上放置照片幻灯片。但是,出于某种原因,我想要使用的所有图片都不在一个幻灯片中,而是在页面上展开成单独的图像。我认为我的HTML存在问题,但我不确定。

这是我的HTML和CSS代码:

.header {
    width: 100%;
    height: 100px;
    background-image: url("../background1.jpg");
    text-align: center;
    padding: 5px;
}

body {
    margin: 0;
    padding: 0;
    background: white;
}

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: deeppink;
}

li {
    float: left;
}

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

li a:hover {
    background-color: pink;
}


/*Slideshow container*/

.slideshow-container {
    max-width: 1000px;
    position: relative;
    margin: auto;
}


/*Next & previous buttons */

.prev,
.next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
}


/* Position right next button */

.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}


/* On hover, add a black background color with a little bit see-through */

.prev:hover,
.next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}


/* Caption text */

.text {
    color: #f2f2f2;
    font-size: 15px;
    padding: 8px 12px;
    position: absolute;
    bottom: 8px;
    width: 100%;
    text-align: center;
}


/*Number text*/

.numbertext {
    color: #f2f2f2;
    font-size: 12px;
    padding: 8px 12px;
    position: absolute;
    top: 0;
}


/*The indicators*/

.dot {
    cursor: pointer;
    height: 13px;
    width: 13px;
    margin: 0 2px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.6s ease;
}

.active,
.dot:hover {
    background-color: #717171;
}


/*Fading animation*/

.fade {
    -webkit-animation-name: fade;
    -webkit-animation-duration: 1.5s;
    animation-name: fade;
    animation-duration: 1.5s;
}

@-webkit-keyframes fade {
    from {
        opacity: .4
    }
    to {
        opacity: 1
    }
}

@keyframes fade {
    from {
        opacity: .4
    }
    to {
        opacity: 1
   }
}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Welcome to Fazbear Entertainment</title>
<link rel="stylesheet" href="css/fnaf.css"></link>
<script type="text/javascript" src="js/fnaf.js"></script>

</head>

<body bgcolor="#FFB6C1">
<div class="header">
</div>

<div id="nav">
    <ul>
        <li><a class="active" href="">Home</a></li>
        <li><a href="">About</a></li>
        <li><a href="">Contact</a></li>
        <li><a href="">Prices</a></li>
    </ul>
</div>

<div class="slideshow-container">
    <div class="mySlides fade">
        <div class="numbertext">1 / 5</div>
        <img src="fnafworld.jpg" style="width:100%">
        <div class="text">Welcome to Fazbear Entertainment</div>
    </div>

    <div class="mySlides fade">
        <div class="numbertext">2 / 5</div>
        <img src="funtimefreddy.png" style="width:100%">
        <div class="text">Funtime Freddy</div>
    </div>

    <div class="mySlides fade">
        <div class="numbertext">3 / 5</div>
        <img src="funtimefoxy.png" style="width:100%">
        <div class="text">Funtime Foxy</div>
    </div>

    <div class="mySlides fade">
        <div class="numbertext">4 / 5</div>
        <img src="baby.jpg" style="width:100%">
        <div class="text">Baby</div>
    </div>

    <div class="mySlides fade">
        <div class="numbertext">5 / 5</div>
        <img src="Ballora.png" style="width:100%">
        <div class="text">Ballora</div>
    </div>

    <a class="prev" onClick="plusSlides(-1)">&#10094;</a>
    <a class="next" onClick="plusSlides(1)">&#10095;</a>
</div>
<br>

<div style="text-align:center">
    <span class="dot" onClick="currentSlide(1)"></span>
    <span class="dot" onClick="currentSlide(2)"></span>
    <span class="dot" onClick="currentSlide(3)"></span>
</div>
</br>
</body>

</html>

是因为我格式化的方式吗? 谢谢你的帮助!

0 个答案:

没有答案