【发布时间】:2020-11-08 16:26:14
【问题描述】:
我有一个内部票务系统,它不允许 JS 并且也不完全允许所有 CSS 标签。 出于这个原因,我不得不调整所有可能的方法来为某些图像构建一个简单的 CSS 滑块(仅使用 CSS 和 HTML )。
我唯一的问题是,每当我单击 Next/Prev 按钮时,都会创建 Jump 效果,然后加载下一张图片。我试图找到一种方法,在加载下一张图片时图片保持在同一位置。
我已经尝试过max-width: 100%; height: auto; 但仍然没有:( .
有什么建议???提前非常感谢
<style>
#slidepicswrap {
width:640px;
height:450px;
margin:0 auto;
position:relative;
font-family:verdana, arial, sans-serif;
}
#slidepicswrap #slides {
position:absolute;
left:0;
top:0;
height:450px;
width:640px;
overflow:hidden;
text-align:center;
}
#gallerywrapper #gallery div {
width:640px; height:900px;
padding-top:10px;
position:relative;
}
#gallerywrapper #gallery div img {
clear:both;
display:block;
margin:0 auto;
border:0;
}
#gallerywrapper #gallery div h3 {
padding:10px 0 0 0;
margin:0;
font-size:18px;
}
#gallerywrapper #gallery div p {
padding:5px 0;
margin:0;
font-size:12px;
line-height:18px;
}
a {
text-decoration: none;
display: inline-block;
padding: 8px 16px;
}
a:hover {
background-color: #ddd;
color: black;
}
.previous {
background-color: #f1f1f1;
color: black;
display:inline;
float:left;
margin-left:80px;
}
.next {
background-color: #4CAF50;
color: white;
display:inline;
float:right;
margin-right:80px;<span id="CmCaReT"></span>
text-decoration:none;
}
.round {
border-radius: 50%;
}
</style>
<div id="slidepicswrap">
<div id="slides">
<div id="pic1"><img src="https://unsplash.it/g/500/350?random" alt="Image 1" width="500" height="350" /> <a class="previous" href="#pic5" rel="nofollow"><</a> <a class="next" href="#pic2" rel="nofollow">></a>
<h3>Image 1</h3>
<p>Text of image 1.</p>
</div>
<div id="pic2"><img src="https://unsplash.it/g/500/350" alt="Image 2" width="500" height="350" /> <a class="previous" href="#pic1" rel="nofollow"><</a> <a class="next" href="#pic3" rel="nofollow">></a>
<h3>Image 2</h3>
<p>Text of image 2.</p>
</div>
<div id="pic3"><img src="https://unsplash.it/g/500/350?random" alt="Image 3" width="500" height="350" /> <a class="previous" href="#pic2" rel="nofollow"><</a> <a class="next" href="#pic1" rel="nofollow">></a>
<h3>Image 3</h3>
<p>Text of image 3.</p>
</div>
</div>
</div>
【问题讨论】:
-
CSS 不是为这些东西而设计的,所以不要指望它能很好地工作。