The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Image sizes attribute relative to the container?
If you’re using a grid e.g. Bootstrap (but it doesn’t matter for the question), how would you set image sizes attribute?
In this case image doesn’t know about column size it will appear in because column size can vary, e.g. col-xs-12, col-sm-6, col-lg-4
In general, I wouldn’t…I’d want the image to be responsive…and Bootstrap (for instance) has classes for that.
Using max-width:100 and height:auto…is generally all you need…
max-width:100
height:auto
If course, responsive means different things in different situations and it depends on your requirements
https://css-tricks.com/responsive-images-css/