Sunnyside-Agency Responsive Landing Page using Flexbox and CSS Grid
Design comparison
Solution retrospective
Hello!, I have a question that I would like to receive some help. In the transform and stand out sections, I don´t know how to give that kind of underline to the a href link that says "LEARN MORE".
Community feedback
- @David404-devPosted over 2 years ago
You can use the border-bottom property in css for those links and when you hover over those links you can also change the color.
For example:
.learn-more-link { border-bottom: 5px solid pink; }
.learn-more-link:hover { border-bottom: 5px solid orange; }
If you don't want the colors to change instantly, check out the transition property.
Marked as helpful0@alosoftPosted over 2 years ago@David404-dev the transition is a nice touch. Using the border-bottom property will give the line the same width as the element (text) which is not the case in the design plus the line is even under the text and not below.
@David404-dev Nice Work!
1 - @alosoftPosted over 2 years ago
@Juan2579 You can add the underline by wrapping the link tag with a div container and an empty div below the link
<div class="container"> <a href="#" class="styled_button yellow"> Learn more</a> <div class="yellow_line"></div> </div>
add these styles for the yellow_line and red_line
.red_line, .yellow_line { width: calc(100% + 0.5rem); height: 0.3rem; border-radius: 1rem; bottom: 0; left: 0; right: 0; margin-top: -0.4rem; background: transparent; }
after that you can show the lines on hover with these styles
.styled_button:hover+.yellow_line { background: var(--yellow); } .styled_button:hover+.red_line { background: var(--soft-red); }
Marked as helpful0
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