Design comparison
Solution retrospective
I'm not sure if this is the right way to keep the <a> tag on the bottom of the parent div without flexbox or grid!
Community feedback
- @elaineleungPosted over 2 years ago
Hi Flivaxa, yes, it's possible to use
position: absolute
to position the<a>
tags; the tricky thing with that is you could run into responsive issues if screen sizes change since the element doesn't move, but you might be able to fix that if you use responsive properties such asmax-width
ormin-width
. Still, you might find yourself needing to make other elements accommodating toposition: absolute
, like that extra margin below your paragraph elements, which I think is a bit of an overkill. Personally I prefer to use flexbox just because I find it easier to place elements, and it takes care of responsiveness usually. In your case, I'd just put a flex box on the parent like this and make other changes to thep
anda
:.card { display: flex; flex-direction: column; height: 30rem; // or min-height if you prefer } .card p { margin-bottom: 1rem; flex: 1; // this tells flexbox to stretch the element to fill the remaining space } .card a { align-self: flex-start // remove the position: absolute; and bottom:40px; }
I'm not sure how much you know about flexbox already, but in case you're just starting out, I encourage you to just keep using it and experimenting with it. It took me awhile to figure it out as well, but once you do, you'll see how powerful of a tool it is. Good luck, and keep coding! :)
Marked as helpful1
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