Design comparison
Solution retrospective
Usually I'm setting padding inside the component for easier positioning. But in this challenge the card at top has no indents at all, so I've set margins to internal content. I believe there is a better solution for this task, but I can't figure it by myself yet
Community feedback
- @vanzasetiaPosted over 2 years ago
Hello there! π
Congratulations on finishing this challenge! π
I recommend adding a container inside the card element as @Bayoumi-dev has suggested to you. This way, you can add
padding
to the container element and then remove themargin
from each element.I have a few suggestions for this solution.
- I recommend making the
body
element as the flex container of the card element. This way, you can remove thedisplay
element. - The music icon is a decorative image. So, leave the
alt
empty. - The "Proceed to payment" button should have
type
ofbutton
(not a submit button). It is not wrapped byform
element. Also, what do you think is going to happen after the users click the button? - I recommend only treating the
body
element as the page of the site. I suggest leaving thehtml
element because thehtml
element is connected with the user's setting (such asfont-size
, etc). - Prefer unitless numbers for line-height values to avoid unexpected results. The MDN documentation explains it well.π
That's it! Hope you find this useful!
Marked as helpful3 - I recommend making the
- @Bayoumi-devPosted over 2 years ago
Hey Kapline,
My suggestions:
- Wrap all the content without the image with the body element
<div class="body">
and then give the body element the padding.
<img src="images/illustration-hero.svg" alt="Music image" class="main_image"> <div class="body"> <h1></h1> <p></p> <div class="plan_card"> //... </div> <button></button> <a href="#" class="cancel_button"></a> </div>
- Instead of adding
border-radius
for the card and the image, Addborder-radius: 20px;
andoverflow:hidden;
to the card only:
.card { background-color: hsl(0, 100%, 100%); border-radius: 20px; display: flex; justify-content: center; align-items: center; flex-direction: column; box-shadow: 0 10px 15px hsl(245, 83%, 68%, 10%); overflow: hidden; /* <--- Add */ } .main_image { /* border-top-left-radius: 20px; <--- Remove */ /* border-top-right-radius: 20px; <--- Remove */ }
Hope this help!... Keep codingπ
Marked as helpful2 - Wrap all the content without the image with the body element
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