I have just started writing code in HTML/CSS/JS and I am a total beginner.
1) I have almost finished my website but at the end I decided to change the background image to an automatic slideshow. The problem is that the slides are not wide enough (see the following image) 1. What should I do to make the slides wider to get rid of white gaps on both sides?
Here is my HTML.
<!--Start Home-->
<section class="home" id="home">
<div class="container">
<div class="mySlides">
<img src="img/Home/вид1 классика.jpg" style="width:100%">
</div>
<div class="mySlides">
<img src="img/Home/спальня море1.jpg" style="width:100%">
</div>
<div class="mySlides">
<img src="img/Home/07.jpg" style="width:100%">
</div>
<div class="mySlides">
<img src="img/Portfolio/4/розовая комната (5).jpg" style="width:100%">
</div>
<div class="mySlides">
<img src="img/Portfolio/3/титова мал спальня (3).jpg" style="width:100%">
</div>
</div>
</section>
<!--End Home-->
Here is my CSS.
/*Home Section*/
.home {
height: 100vh;
background-size: cover;
background-position: center;
}
And JS.
// Automatic Slideshow - change image every 5 seconds
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);
}
At the top of the CSS code I wrote the following:
html {
scroll-behavior: smooth;
}
body {
margin: 0;
font-family: 'Montserrat', sans-serif;
}
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
max-width: 1140px;
margin: auto;
}
.row {
display: flex;
flex-wrap: wrap;
2) UPD: THX for help now it works!
Looking forward to getting answer from you guys. Thank you in advance.