I am currently working on a project for internship and got a problem with the website. Let me describe the problem so I have a slideshow on the page and got a button and a div placed on it with position: absolute;. But the image doesn’t scale depending on the content so it goes out of the image.
This is my js, html and css code for the slideshow and button and clear div:
**JS Code:**
<Script>
var i = 0;
var images = [];
var time = 3000;
// Image list
images [0] = 'img/image1.png';
images [1] = 'img/image2.png';
images [2] = 'img/image3.png';
images [3] = 'img/image4.png';
// Change Image
function changeImg() {
document.slide.src = images[i];
if (i < images.length - 1) {
i++;
} else {
i = 0;
}
setTimeout("changeImg()", time);
}
window.onload = changeImg;
</Script>
**Html code:**
<div class="slideshow-content">
<!-- Slideshow -->
<img class="slideshow" name="slide">
<!--White box on slideshow-->
<div class="DivOnImage">
<p class="TitleOnImage">UITZENDEN ZOALS HET HOORT</p>
<p class="TextOnImage">'DE VRIJE WERKERS is een unieke, bewezen en door overheid goedgekeurde backoffice methode
waarmee uitzendkrachten <b>nooit in vaste dienst</b> hoeven, <b>bruto uitbetaald worden</b> (en zo meer
overhouden), <b>beter verzekerd</b> zijn, <b>pensioen</b> opbouwen, de <b>administratieve rompslomp wordt
geëlimineerd</b>, en <b>uitzendbureaus meer verdienen.*</b></p>
</div>
<div>
<!--Button on slideshow-->
<button class="button3" type="button">MEER INFO</button>
</div>
</div>
**CSS code:**
* {
margin: 0;
font-family: Calibri;
}
IMG.slideshow {
object-fit: cover;
display: block;
max-height: 340px;
width: 100%;
}
.button3 {
background-color: #5BD8C0;
position: absolute;
width: 157px;
height: 35px;
top: 250px;
border: none;
outline: none;
text-align: center;
text-decoration: none;
font-size: 17px;
color: white;
font-weight: lighter;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.button3:hover {
background-color: #68BBCE;
cursor: pointer;
}
.DivOnImage {
position: absolute;
width: 70%;
height: auto;
top: 60px;
background: rgb(255, 255, 255);
background: rgba(255, 255, 255, 0.7);
position: absolute;
left: 50%;
transform: translateX(-50%);
padding-left: 30px;
padding-right: 30px;
padding-bottom: 30px;
}
.TitleOnImage {
font-size: 38px;
color: black;
font-weight: bold;
text-align: center;
padding-top: 30px;
}
.TextOnImage {
color: black;
text-align: center;
padding-top: 15px;
max-width: 100%
}




