"image responsive using srcset and sizes"
Bootstrap 4.1.1 Snippet by ALIMUL AL RAZY

1
2
3
4
5
6
7
8
9
10
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<img src="https://ik.imagekit.io/demo/img/responsive_images_srcset_sizes_assets/big/1.jpeg" srcset="https://ik.imagekit.io/demo/img/tr:w-500/responsive_images_srcset_sizes_assets/big/1.jpeg 500w, https://ik.imagekit.io/demo/img/tr:w-800/responsive_images_srcset_sizes_assets/big/1.jpeg 800w, https://ik.imagekit.io/demo/img/tr:w-1024/responsive_images_srcset_sizes_assets/big/1.jpeg 1024w" sizes="(min-width: 1024px) 1024px, 100vw">
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
img {
max-width: 100%;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: