I am making an image carousel using Slick. I want to fit the width of the image along screen and the height is scaled with the width. Below is my index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>slick test</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="slick/slick-theme.css"/>
</head>
<body>
<div class="carousel-container">
<div >
<img class="carousel" src="images/1.jpg">
</div>
<div >
<img class="carousel" src="images/2.jpg">
</div>
<div >
<img class="carousel" src="images/3.jpg">
</div>
</div>
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="slick/slick.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
Below is my attempt in style.css:
.carousel-container {
margin: 0;
padding: 0;
max-width: 100%;
width: 100%;
}
carousel {
width: 100%;
height: auto;
}
The images seem to be printed at its original resolution.
How to make it right? Do I need to change anything in slick.css or something else?
I did not understand this line
Hope this is what you want.
here to make the image fill entire scree I have made div to 100wv then added
width: 100%; height: 100%; object-fit: coverto the img tag.added few settings to slick
arrows:false,to hide arrows.