Design comparison
Solution retrospective
Hi,
I would like your help on how to put that little triangle at the top op the collapsable menu
thanks for your feedback!
Community feedback
- @imadvvPosted about 2 years ago
Greeting kellyc!! Congratulations for completing Your challenge!, 👏👏👏
it seem like the classic way to create a triangle with CSS, is to use
border
, The idea is a box with zero width and height. The actual width and height of the arrow is determined by the width of the border. for example the bottom border and right border is colored while the left and top are transparent, which forms the triangle as showing on the design.border-top: 1.5rem solid transparent; border-left: 1.5rem solid transparent; border-right: 1rem solid white; border-bottom: 2rem solid white;
if you need some reference you can check out my solution here I solve it with this approach, and for more information you can check out this article.
over all, Hope this help!!
Happy Codding, Have a Good Day.Night
Marked as helpful1 - @Enmanuel-Otero-MontanoPosted about 2 years ago
Hi Kellyc!
You should use the after or before pseudo-elements as you see fit and apply the following styles. I leave you a sample.
.header__nav::before { content: ""; position: absolute; top: -35px; right: 0; border-right: 35px solid hsl(0, 0%, 100%); border-top: 35px solid transparent; border-left: 35px solid transparent; }
That is a sample of my code, you must adapt it to your code.
Cheers!
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