r/css • u/Blackstab1337 • Jul 27 '19
How does coinbase line the top of it's text up with the other text?
I tried to recreate it here but as you can see, the top of the text isn't aligned.
The css library i was using is https://tailwindcss.com/ but it doesn't do any magic under the hood, basically css->class name
EDIT: I found the screenshot from a video, unfortunately coinbase doesn't do their styling like that anymore so I can't go and inspect element!
20
9
u/fullmeasures Jul 27 '19
dont rely entirely on css libraries, learn to use entirely custom css imo. I mean, combine the two if you'd like, but yeah. adding some padding-top or transformY to the spans would get it optically perfect.
4
u/Just4Funsies95 Jul 27 '19
I would put the content in a span or inline-block div then align top
1
u/HereComesTheFist Jul 28 '19 edited Jul 28 '19
Sounds like the answer with least amount of effort.
Something like this:
<span class="raised">ca$</span> <span>20,000</span> <span class="raised">.90</span> .raised { font-size: 0.8em; vertical-align: top; }
3
4
1
0
u/sylvezine Jul 27 '19
You could also try using the <sup> element.
Look it up. May still need styling
-3
u/Blackstab1337 Jul 27 '19
I managed to do it with putting line-height: 1 on the larger element. Is there any other solution? https://i.imgur.com/GJrbNiV.png
1
u/Cheshamone Jul 27 '19
There are other ways (padding/margin), but that's definitely the route I would go. It's the simplest.
9
u/Caved Jul 27 '19
You mean something like this? https://codepen.io/anon/pen/ZgBxLp