[英]How can I make a image in a slide show to full width?
I have this website: https://acanhs.org
I want the slide show at the beginning to be at full width on all devices.我有这个网站:
https://acanhs.org
: https://acanhs.org
我希望开头的幻灯片在所有设备上都是全宽的。 What can I add to make that happen?我可以添加什么来实现这一点?
My html:我的html:
<div class="w3-content w3-section responsive">
<div class="mySlides w3-animate-top responsive" style="--background-image: url('homepagepictures/81463156_472179973704673_8295529433598935850_n(1).jpg')" >
</div>
<div class="mySlides w3-animate-bottom responsive" style="--background-image: url('homepagepictures/097f1e08-ebfe-434a-bc68-8020d02cee6e.JPG')">
</div>
<div class="mySlides w3-animate-top responsive" style="--background-image: url('homepagepictures/8291878a-b5ad-4003-8cc6-de7baafd84a0.JPG')">
</div>
<div class="mySlides w3-animate-bottom responsive" style="--background-image: url('homepagepictures/27890996_211176766129569_6923967286697000960_n.jpg')">
</div>
<div class="mySlides w3-animate-top responsive" style="--background-image: url('homepagepictures/42914143_364663130939605_1259772328364992140_n.jpg')">
</div>
<div class="mySlides w3-animate-bottom responsive" style="--background-image: url('homepagepictures/42947322_373232869884042_7326776160519321694_n.jpg')">
</div>
<div class="mySlides w3-animate-top responsive" style="--background-image: url('homepagepictures/44689929_944494762409958_8911408401400786089_n.jpg')">
</div>
<div class="mySlides w3-animate-bottom responsive" style="--background-image: url('homepagepictures/fd2b6c09-19b7-42ad-b7fb-bce6dc983690.JPG')">
</div>
<div class="mySlides w3-animate-top responsive" style="--background-image: url('homepagepictures/IMG_6922.jpg')">
</div>
<div class="mySlides w3-animate-bottom responsive" style="--background-image: url('homepagepictures/IMG_6932.jpg')" >
</div>
</div>
My javascript:我的javascript:
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 5000);
}
I have tried a lot of stuff but I'm new to web development so it's most likely a mistake on my end.我已经尝试了很多东西,但我是网络开发的新手,所以这很可能是我的错误。
You need to add this css to your element: <div class="w3-content w3-section responsive">
您需要将此 css 添加到您的元素中:
<div class="w3-content w3-section responsive">
margin-left: 0px;
margin-right: 0px;
width: 100%;
max-width: unset;
This is to get rid of the left and right margin, then to make the div full-width.这是为了摆脱左右边距,然后使div全宽。 As for the
max-width
, I saw that you had it set on 980px
, so you need to set it on unset
.至于
max-width
,我看到您将其设置为980px
,因此您需要将其unset
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.