Responsive Recipe Page using CSS media query
Design comparison
Solution retrospective
I am proud that in this challenge I have learned how to handle many types of style difference in a single page and keep the CSS style sheet as clean as possible.
I would try to make different files for different classes/styles (Ex. general.css, utilities.css etc.)
What challenges did you encounter, and how did you overcome them?Implementing the difference of styles like color, font-weight, font-family, list bullet point styles etc. while keeping my CSS code clean were challenging for me.
Most of the cases I have overcome them by making my own custom utility CSS classes and implementing them on desired html elements.
What specific areas of your project would you like help with?In the first unordered list of this page , in the first list item the last word 'minutes' when it comes to mobile viewport goes to next line which is okay but it does not horizontally aligns with the first line.
I need help to solve this problem.
Community feedback
- @Michal-MajchrzakPosted 13 days ago
Hey Shah 👋, congrats on finishing the challenge i like your utility classes approach. 😀
Regarding your unordered list problem. Text in
li
element is not aligned when it breaks to new line because of the::before
pseudo-element andposition: relative
. In relative position element is still part of document flow and space for it is still reserved even if visually it is in different location.When you change position from
relative
toabsolute
onli::before
, the element will be removed from normal document flow and space for it wont be reserved ( which is causing misalignment )..card-unordered-list-custom-style li::before{ position: absolute; left: -1.4rem; }
Now to set
::before
next toli
text ,we can addposition: relative
toli
item itself.li { position: relative }
Because of that change, now
::before
will be positioned relative toli
element which is closest positioned ancestor. If you want to read more on position this MDN documentation on position helped me to figure this out.Hope this was helpful, have a nice day and Happy Coding😀
Marked as helpful0
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