Hello everyone! FlexBox is one layout I really want to know like the back of my hand I have completed some tutorials on it but I still run into few issues which makes feel bad.
Now to my problem, i have some (6) images I want to make responsive by utilizing the FlexBox layout… At desktop view, the images wraps well ( 2 by 3) and when I resize to mobile view, it stacks over one another like a column which is good… The headache comes in when I tried to adjust the width of the flex-items, using"width" or “flex-basis” properties on “image-collections”, the images become disorganized and overflow the “flex-container”…
On img{ ;} selector, when trying to resize the images width, percent% units seems to move the image apart from each other on desktop view…
Thanks for your response, when I added a width of 100% of to the .image-collections, the images overflows the container and the wrapper at certain screen size (512px downwards)… I even tried to reduce the width to 50% but the images were all over each other.
It can be difficult to manage images with different aspect ratios although there is a new css property arriving that will help with this but not ready for prime time yet.
Even with the help of the new property there’s some questions see need to know first.
We can force the images to be the same width and height and then use object-fit cover on the image to maintain aspect ratio but this will involve the image being cropped in some way.
Or you can use object-fit:contain to avoid cropping but they won’t stay the same size as each other.
Or you could just let images do their own thing but center them vertically or indeed align top or bottom. Captions could be aligned with flexbox so they are on a line.
It all depends how you want this to look but the thing to remember is that images can only be the same size if they are cropped in some way assuming different aspect ratios. This could result in you losing the head of a person if there is a great difference in aspect ratio.
It stops ios from increasing the font-size when you rotate the device. It’s generally not what you want when you have designed the page properly using media queries.