Design comparison
Solution retrospective
I'm having difficulties to align some elements:
- Music Icon
- Annual Plan Title
- "Change" link.
At first, I had all the elements horizontally aligned, but I wasn't able to float the "Change Link" to the right side. Made same changes in the CSS e HTML and ended up with this.
Anyone could help me please?
Community feedback
- @RafisEliasPosted over 2 years ago
Amazing work man, to fix the alignment problem you can do somethings:
I: in the
<div id="neste"></div>
add in the css the:... #neste { display: flex; /* <-- this will make the div alignment horizontally */ align-items: center; /* <-- this will make the child elements alignment to the center of the div */ gap: 16px; /* <-- this will add a spacing between the child elements */ }
you can remove the
margin-right
of the Music Icon now you are using thegap
II: In the
.plan-info
class you can add thealign-items: center;
III: You can also remove the margin of the
<p>
tag:... p { margin: 0 }
i hope this can help you.
Marked as helpful1@dnlblumPosted over 2 years ago@RafisElias Rafael, thank you very much for investing some time to review the code and give me some tips. Your suggestion did work great. But I just figured out that in the css code was calling the ID using ".nested" instead of using "#nested". So all the attributes I tried wasn't been applied to layout. Thank you again.
0 - @Enmanuel-Otero-MontanoPosted over 2 years ago
Hello Daniel!
Consider using this structure (it's your modified HTML code)
<div id="neste"> <img class="plan-icon" src="images/icon-music.svg" alt="Music Icon Illustration"> <div class="price"> <p class="bold">Annual Plan</p> <p>$59.99/year</p> </div> <p><a class="float-right" href="#">Change</a></p> </div>
Then apply to the div with the nested id the following properties
#neste { display: flex; align-items: center; justify-content: center; }
You'll need to apply some margin-left to the "p" tag that wraps the link and some height and width to the div with the nested id. All this until the desired design is achieved.
hope this helps
Cheers
1@dnlblumPosted over 2 years ago@Enmanuel-Otero-Montano Thank you very much for investing some time to review the code and give me some tips. I just figured out that in the css code was calling the ID using ".nested" instead of using "#nested". So all the attributes I tried wasn't been applied to layout. Thank you again.
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