My goal is to place a rotated headline next to some text, but I'm facing challenges with positioning when the page is resized. While absolute positioning works easily in a static scenario (left picture), it fails when the page size changes (right picture).
Current CSS (subject to change):
.headline {
white-space: nowrap;
position: absolute;
top: 185px;
left: -20px;
transform: rotate(270deg);
}
Current HTML structure (subject to change):
<header>
<h1 class="headline">About Me</h1>
</header>
<div class="text">
<p class="introduction">....</p>
</div>
I'm looking for a solution to position the element so that it always stays 20px
away from the paragraph. Are there any existing patterns or resources that can help me solve this issue?
A Javascript (and jQuery) workaround could be an option, although I would prefer a CSS-based solution.