Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Landing page responding to 4 different screen sizes

Alex Kim 1,325

@alex-kim-dev


Design comparison


SolutionDesign

Solution retrospective


There's a couple of slightly different buttons in this challenge. What's the best approach for organizing these small differences in css?

My solution is to make a class button for the white one, and a modifier button-accent for the pink one. (i use bem with camelCase & single dash/hiphen) Both include different styling for various screen sizes. But the pink button is slightly different in some cases: a bit wider or has smaller text while keeping the same height. I reflected these changes in additional contextual classes: hero_button & cta_button.

Community feedback

Gerben Dol 3,115

@GerbenDol

Posted

That's a great quest Alex and I like your solution!

I'd either do it that way, so add another modifier classes, or maybe I'd make it contextual in the sense of "When my button-accent is in my hero section apply these extra styles.

It kinda depends on the design which one will give the appropriate flexibility, but I think both work well. Your take on it I feel is more predictable and understandable, but making it depend on the wrapping div I feel makes it easier for me not to mess it up. No classes on the button I can forget to apply in different pages.

2

Alex Kim 1,325

@alex-kim-dev

Posted

Thanks for the feedback!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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