How to match border height of element
I have 2 links inside a container in the picture.
The markup looks something like this:
And the styles are something like this:
You'll see that the seconday-cta is slightly bigger because of the border around it. The secondary-cta link is about 50px height, and the primary-cta link is about 48px height. I've tried setting a
min-height
on the primary-cta to 100%
but no dice. I know this is a simple issue but I seem to struggle with it a lot
21 Replies
2 ways you could tackle this - you could add
box-sizing: border-box
on the anchors or you could calculate the amount for the top/bottom height of the border and add that to the height of your primary buttontake off the align-items center it should match heights
shouldn't need it anyway?
yeah possibly - can we see what the code looks like for the buttons themselves?
Oh duh... yes b1 was right with
align-items: center
... should have figured that one out 😅 thanks for the replies guysohhh thats the footer styles
yup lol
Yea sorry lol I should have included more code but didn't want to copy and paste my whole thing in there
It's a footer to the hero ahha
lol all good 😄
na that is a odd quirk honestly xD
Yea you'd think
display: flex
would stop its items' heights from 'stretching' automatically without align-items on it since it does it with width lolThis is one those things where I found grid auto-flow column to be nicer than flex #depends causxe you have align-content
i mean "flex" and "stretch" are the same 😉 😉 😉
plus you can also just do
place-items: center;
for grid and that is so much betteri've been using grid more lately 😎
same
I actualyl don't even know why I had
align-items
on it anyway I think I'll just take it off completelythough writing conditional grid layouts are not fun
i dont even wanna think about that lolll

Ohhh that actually doesn't look that bad, just tedious and code organization probably gets thrown out the window with that a little bit
literally just a toggle for a 1px divider 😄
I've been doing some with [data-sets] because Prismic sends them already.
its pretty nice actually >.>;;
also just converting from CSS-in-JS to classes only is also a nightmare 🙂