Design comparison
SolutionDesign
Solution retrospective
working with image is particular difficult for me, I had issue when I reduce the screen size, the image in the container shrink up to a point it disappear.
Another issue I'm having although I use flexbox properties of flex: 1 in the flex items the two containers which is the flex items still shrink and I'm not sure why.
thanks in advanced for any comments provided.
thanks
Community feedback
- @ChamuMutezvaPosted 12 months ago
HI
- when styling , use the mobile first approach, where your first styles should be targetting mobile and the use a media query when necessary using the
min-width
. - after creating your html structure start styling from outside to inside, to enable to create some layouts. Here is what I mean, It is normally said the
box model
or everything in CSS is a box. Since you are starting from outside, which is the body:
- Do you have a box or boxes? This is important to determine the
max-width
of your container. For simplicity , let us remove the footer element from the code altogether so that we have one box (the main) remaining. What we are saying here is that , thebody
element has one childmain
element. Then , how does this box (main
) relates to the body in mobile view, tablet , desktop view etc? Points to bear in mind are as follows:
- They should be some space between the body and its child - we can add
padding: 1rem
to the body. That will always guarantee a space of 1rem regardless of whatever device you are using - What is the maximum width the
main
container should grow to. Yes using max-width isresponsive
, than usingwidth
. Lets give themain
element amax-width: 64rem
(note - this is a random figure , use the design to get the actual max value). - as for centering, we have
flex
to use to our advantage on thebody
. Right , check the responsiveness and presentation of the main element using Devtools or on actual devices.
this declaration on images is usually enough:
/* Make images easier to work with */ img, picture { max-width: 100%; display: block; }
0 - when styling , use the mobile first approach, where your first styles should be targetting mobile and the use a media query when necessary using the
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord