Design comparison
Solution retrospective
Is it better to put margins on container divs or on the individual elements? Should all text be organized into a div together or are the individual tags (h2, p) enough? -Additionally, as a note to myself, I would like to learn more about absolute positioning vs positioning using flexbox
Community feedback
- @MelvinAguilarPosted about 1 year ago
Hello there π. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
CSS π¨:
- If the sole purpose is just to group the text elements together, then using an additional div is unnecessary, as it would only add an extra tag without a clear functional purpose. However, if you plan to apply styles or other properties to both the h2 and p elements collectively, then wrapping them in a div is a valid approach to ensure consistent styling and structure.
-
Avoid using
position: absolute
to center an element as it may result in overflow on some screen sizes. screenshot-imgur (landscape mode)πΈInstead, utilize the flexbox or grid layout for centering. Get more insights on centering in CSS here here π.
- You should use the
box-sizing: border-box
property to make thewidth
andheight
properties include the padding and border of the element. This will make it easier to calculate the size of an element. You can read more about this here π.
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
1
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