Design comparison
Solution retrospective
This is my version of the Order summary component.
This took me about 2hrs to complete. It was good practice with flexbox and grids.
I added a little bit of JavaScript, so the messages change when the buttons are clicked.
As always, any advice or feedback would be greatly appreciated.
Community feedback
- @adonmez04Posted about 1 year ago
Hi, @TKD5. It's a good solution. Keep coding. Here are some important tips.
1 - I highly recommend to markup your content with HTML first. HTML itself is responsive, so your content will increase and decrease depending on the screen size of the device. You can see this if you to markup your content with HTML without writing any CSS code first.
2 - When trying to style from CSS, you shouldn't break this HTML behavior. To keep HTML responsive behavior, we can to set the container's
max-width
value in CSS, so we limit themax-width
value of the container, but we don't declare any thewidth
value. With this style, the container itself (and its child elements) will be responsive until itsmax-width
value.You can remove all
width
values from elements. Use onlymax-width
to limit your container element.For example:
container { max-width: 450px; /* The desktop width of the container depending on the design file */ /* width: fit-content; */ /* You don't need this */
@media only screen and (max-width: 376px) .container { max-width: 327px; /* The mobile width of the container depending on the design file */ /* width: min-content; */ /* You don't need this */
3 - You also don't need to declare any
width
andheight
values for images. Use this declaration block to keep images responsive:.top-image { max-width: 100%; display: block; height: auto; }
4 - I highly recommend using
margin-bottom
to give your elements a vertical margin. It's easy to read and understand.I hope these will help you. Keep coding and have a wonderful day.
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