This is a solution to the Order summary card challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- See hover states for interactive elements
- Solution URL: https://github.com/DCoder18/Order-Summary-Component
- Live Site URL: https://order-summary-deecoder.netlify.app/
- SCSS
- Flexbox
- BEM Model
This project helped me practice advanced CSS concepts like flexbox and the BEM model for efficient code.
Something helpful I learnt in flexbox is a way to align a single item horizonatally. As we know justify-content
helps us do this
but what if I want to use it to align just a single element? In this project I struggled a bit with aligning the Change now
CTA in
the Annual plan section with flexbox. At first I tried justify-content: space-between
but I realized the music icon and the header
don't have equal space between them but I still needed the CTA on the other end! That got me thinking if there was a way for justify-content
to work like align-self
. After rummaging through some Stack Overflow threads, I came across the perfect solution.
.btn-change {
margin-left: auto;
justify-content: flex-end;
}
The above worked like a charm. If an element had to be aligned to the left, just use margin-right: auto;
.
I'm still not 100% comfortable with efficient responsive code.
- Frontend Mentor - @DCoder18