I have a problem with vertically aligning text using flex
in my web application using Tailwind
. Here is part of my code:
<div className="flex flex-col gap-4">
<div className="font-bebas bg-font-color ">
<h1 className="text-font-color text-4xl flex flex-row gap-2 items-end">nothing but
<p className="text-secondary text-5xl self-end">the best</p></h1>
</div>
<h2 className="text-secondary font-nautigal text-5xl">Frank Sinatra</h2>
</div>
My goal is to have the text "nothing but" and "the best" in the same line. How can I achieve this?
2
Answers
It does seems to me like the proper way, but it works. I had to set bigger text
line-heigt
to45px
and the smaller one to15px
.<span>
instead of<p>
<span>
hope this will work as you expected.