Design comparison
Solution retrospective
Any advice about the layout in general?
The button starts glowing upon hovering, but if you click it, the glow gets stuck, no matter where you move the mouse, until you click on something else. How can I make the button glow and stop glowing when I stop hovering? My solution is a bit of a hack, using ::after pseudoelement, so I am not sure how to fix it.
This was also my intro to typescript. I installed it, because I like that strongly-typed languages make it easier to fix some mistakes, so I hoped this could help. I didn't have much use of it yet, since the only script needed here is to fetch advice from the API.
Community feedback
- @DavidMorgadePosted over 2 years ago
Hello man, congrats on finishing the challenge, I think I know why your button is getting the box-shadow effect when clicked.
You are using the
:focus
pseudoelement, this mean that your button will get the opacity prop every time is focused (when is clicked and you dont click in other elements), you dont need to set a focus or after to get the desired effect, you can remove both pseudoclasses and just keep:hover
with these styles:#btn:hover { box-shadow: 0 0 2em 0.5em hsl(150, 100%, 66%); transition: box-shadow 500ms linear; }
Hope this helps, just with the
:hover
pseudoelement you will get the desired result.1 - @tlauffsPosted over 2 years ago
Try using the :hover Selector instead of an ::after pseudoelement to create the glow effect. It will only trigger on hover and you should only need a box-shadow to create the effect. You should also consider adding a :focus state for keyboard navigation as :hover states aren't shown.
1 - @ArturHarutyunyan1Posted over 2 years ago
Make your
.advice-container
centered.*{margin: 0; padding: 0; box-sizing: border-box}
. Removebody{padding: 10%;}
and set body height tobody{height: 100vh}
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