As a general rule them, don't forget to set max-width: 100%
to all images. This can be added to the CSS reset that you use.
img {
max-width: 100%;
object-fit: cover;
}
Examples and use cases
Image
- Previous Grouping vendor selectors
- Next Position sticky with CSS Grid
Support Defensive CSS
Do you like the content? You can buy me a cup of coffee. Thank you!
About the author
Ahmad Shadeed
Ahmad is a UX designer and front-end developer from Palestine. He enjoys working on challenging design and front-end development projects. He wrote a book on debugging CSS, writes extensively on CSS, Accessibility, and RTL (right to left) text styling.