我正在尝试在我的网页中实现滑块。然而,图像似乎堆叠在彼此之上,而不是显示图像从一个页面滑动到下一个页面。 滑块'<'和'>'箭头也是堆叠的,出现在页面的底部。 我一遍又一遍地编辑了这个,并开始忽略如何编辑滑块。
任何人都可以指导我为什么图像没有集成到滑块中吗?
非常感谢任何帮助。这是代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<div align="center">
<p><img src="1_Images/Porshce Emblem.jpg" alt="Porsche Emblem" width="151" height="94" longdesc= "https://www.google.com/search?q=porsche+emblem&safe=off&tbm=isch&imgil=e3SyBtCbC2kTgM%253A%253Bhttps%253A%252F%252Fencrypted-tbn2.gstatic.com%252Fimages%253Fq%253Dtbn%253AANd9GcQN4XhkcCDBk4z-ZnDUyqPlFdU0jZCu4zqA_G9W5nUkfHPVFKaI%253B1600%253B1039%253BsCzj1iXrWOgv-M%253Bhttp%25253A%25252F%25252Fwww.zeroto60times.com%25252Fblog%25252Flarge-car-logos-2%25252Flarge-porsche-car-logo%25252F&source=iu&usg=__kv3nkjDu2-Zh6vo4K9VKHSpmMLc%3D&sa=X&ei=ISi0U6GRDcKYyAS8nYKgDw&sqi=2&ved=0CB4Q9QEwAA&biw=1280&bih=621#facrc=_&imgdii=_&imgrc=e3SyBtCbC2kTgM%253A%3BsCzj1iXrWOgv-M%3Bhttp%253A%252F%252Fwww.zeroto60times.com%252Fblog%252Fwp-content%252Fuploads%252F2013%252F02%252Fporsche-cars-logo-emblem.jpg%3Bhttp%253A%252F%252Fwww.zeroto60times.com%252Fblog%252Flarge-car-logos-2%252Flarge-porsche-car-logo%252F%3B1600%3B1039"/></p>
<head>
<style type="text/css">
@import url("http://fonts.googleapis.com/css?family=Varela+Round");
html, body { background: #333 url("http://codepen.io/images/classy_fabric.png"); }
<!--do not edit position-->
.slides {
padding: 0;
width: 800px;
height: 300px;
display: block;
position: relative;
margin: auto;
left: 0px;
right: 0px;
top: 0px;
}
.slides * {
user-select: none;
ms-user-select: none;
moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
.slides input { display: none; }
.slide-container { display: inline, block; }
<!-- image properties below-->
.slide {
top: -12px;
opacity: 0;
width: 800px;
height: 300px;
display: block;
position: relative;
transform: scale(0);
transition: all .7s ease-in-out;
left: -98px;
}
.slide img {
width: 100%;
height: 100%;
}
.nav label {
width: 50px;
height: 100%;
display: none;
position: absolute;
opacity: 0;
z-index: 9;
cursor: pointer;
transition: opacity.2s;
color: #FFF;
font-size: 100pt;
text-align: center;
line-height: 300px;
font-family: "Varela Round", sans-serif;
background-color: rgba(255, 255, 255, .3);
text-shadow: 0px 0px 15px rgb(119, 119, 119);
}
.slide:hover + .nav label { opacity: 0.5; }
.nav label:hover { opacity: 1; }
.nav .next { right: 0; }
input:checked + .slide-container .slide {
opacity: 1;
transform: scale(1);
transition: opacity 1s ease-in-out;
}
input:checked + .slide-container .nav label { display: block; }
.nav-dots {
width: 100px;
bottom: -75px;
height: 59px;
display: block;
position: block;
text-align: center;
left: -284px;
}
<!-- arrow stats
.nav-dots .nav-dot {
top: -5px;
width: 100px;
height: 11px;
margin: 0, 4px;
position: fixed;
display: inline-block;
background-color: rgba(0, 0, 0, 0.6);
}
.nav-dots .nav-dot:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.8);
}
input#img-1:checked ~ .nav-dots label#img-dot-1,
input#img-2:checked ~ .nav-dots label#img-dot-2,
input#img-3:checked ~ .nav-dots label#img-dot-3,
input#img-4:checked ~ .nav-dots label#img-dot-4,
input#img-5:checked ~ .nav-dots label#img-dot-5,
input#img-6:checked ~ .nav-dots label#img-dot-6 {
background: rgba(0, 0, 0, 0.8);
}
.slide1 {
top: -10px;
opacity: 0;
width: 600px;
height: 300px;
display: block;
position: absolute;
transform: scale(0);
transition: all .7s ease-in-out;
left: -298px;
}
</style>
<body>
<!-- code for the sliders position on page-->
<ul class="slides">
<input type="radio" name="radio-btn" id="img-1" checked />
<li class="slide-container">
<div class="slide">
<!--Image 1 - first image in slider-->
<img src="1_Images/Porsche Homepage.jpg" /><img src="1_Images/porsche_cayman_s_5-wide[1].jpg" width="110%" class="slide-container" /><img src="1_Images/Porsche Transparent Car.jpg" height="82%" /><img src="1_Images/Porsche 918.jpg" /></div>
<div class="nav">
<label for="img-6" class="prev">‹</label>
<label for="img-2" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-2" />
<li class="slide-container">
<div class="slide"> </div>
<div class="nav">
<label for="img-1" class="prev">‹</label>
<label for="img-3" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-3" />
<li class="slide-container">
<div class="slide"></div>
<div class="nav">
<label for="img-2" class="prev">‹</label>
<label for="img-4" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-4" />
<li class="slide-container">
<div class="slide"></div>
</li>
<li class="slide-container">
<div class="slide">
<div align="center" class="slide-container"></div>
</div>
<div class="nav">
<label for="img-4" class="prev">‹</label>
<label for="img-6" class="next">›</label>
</div>
</li>
<input type="radio" name="radio-btn" id="img-6" />
<li class="slide-container">
<div class="slide-container"></div>
</li>
<li class="slide-container">
<div class="nav">
<label for="img-1" class="nav-dot" id="img-dot-1"></label>
<label for="img-2" class="nav-dot" id="img-dot-2"></label>
<label for="img-3" class="nav-dot" id="img-dot-3"></label>
<label for="img-4" class="nav-dot" id="img-dot-4"></label>
<label for="img-5" class="nav-dot" id="img-dot-5"></label>
<label for="img-6" class="nav-dot" id="img-dot-6"></label>
</div>
</li>