and
having trouble on small screens
please help me
kindy provide the answer so i can learn here
img {
display: block;
height: 100%;
width: 100%;
object-fit: cover;
}
div {
width: 100%;
aspect-ratio: 1;
background-image: url('https://picsum.photos/1200/800?random=1');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
img {
display: block;
height: 100%;
width: 100%;
object-fit: cover;
}
div {
width: 100%;
aspect-ratio: 1;
background-image: url('url to your image');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100%;
aspect-ratio: 1;
background-image: url('url to your image');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
.gallery {
display: flex;
flex-wrap: wrap;
border: none;
height: auto;
margin-top: 2rem;
}
.gallery img {
width: 20%;
flex: 1 0 20vh;
object-fit: cover;
display: block;
max-width: 100%;
margin: .5rem;
border-radius: .25rem;
}
</style>
</head>
<body>
<div></div>
<section class="gallery">
<img src="url to your image" />
<img src="url to your image" />
<img src="url to your image" />
<img src="url to your image" />
</section>
</body>
</html>
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.