Design comparison
Solution retrospective
I don't know how to add suitable size to my elements adding width height min-height max-width I want to know more about px rem vw?
Community feedback
- @asbhogalPosted over 1 year ago
Hi Aslam,
When you use sizing, you should use
rem
units. There are converters which use the base of16px
to convert these for you. In general with containers, you should use amax-width
on the parent container with an explicit value (ie. unit) and awidth: 100%
with@media
queries for padding with smaller devices. For eg., if yourmax-width
is350px
, by the time you get down to that value in the viewport, the content will touch the sides, so you can add apadding
property for thebody
element in a@media
query for this width so you still have some spacing. Themax-width
means that with viewports above that width, it will always stay at that fixed value, and with viewports below it, the content will take up the full (ie.100%
) width of the parent container.You should also avoid setting explicit
heights
to the parent container andwidth
andheight
properties to the child elements inside it because this can cause overflow issues. It's best to let them occupy the space they need to naturally.With this, hopefully you can refactor your code with these changes. If you need any further help, let me know.
Marked as helpful1@AslamtoIbrahimPosted over 1 year agoHello dear, First, I thank you for your valuable and important feedback. You told me it's better for me to avoid setting the height and let the children elements take their appropriate heights. However, when I did that, all the elements started to stack in one place, and the flex doesn't affect them anymore. Is there any way I can make all the elements take their positions and appear as if they have a specific height?
0
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