I have a primary and a secondary headline. The primary headline is longer and should be centered. The second headline should start exactly where the first one starts. So if this is my setup:
<h1 className="sofortcheck__headline--mobile">
Check your situation for free
</h1>
<h2 className="sofortcheck__subheader--mobile">
Only <span>2 minutes</span>
</h2>
I want both of those lines to start at exactly the same spot (on all devices) after I center the first line.
Is there a way to do this in pure CSS?
So far I can only think of getting the left offset in JavaScript and then setting that for the second headline, but I feel like there should be a way to achieve this in CSS only.
When I center both elements the second one starts later than the first one because it's shorter.
When I use px margins it doesn't work for different screens.