How to fit an image in a div?
3 answer(s)
Answer # 2 #
- Use CSS properties:
cssdiv { width: 300px; height: 200px;}div img { width: 100%; height: 100%; object-fit: cover; /* or contain */}
cssdiv { width: 300px; height: 200px;}div img { width: 100%; height: 100%; object-fit: cover; /* or contain */}