I've been working on my portfolio site and came up with a unique idea for the landing page – having the name placed in the center and then transitioning into a navbar when a route is selected.
However, I'm facing a dilemma. To achieve this effect, I either have to position the navbar items absolutely (which I'd like to avoid) or center the name relative to its original position on the screen (also not ideal).
You can see how it currently looks here
I am using Vue with Tailwind, but would appreciate a vanilla HTML solution as well.
This is the code snippet I have:
<template>
<header
class="bg-black/25 py-3 transition-[max-height] duration-1000 ease-in-out max-h-screen h-screen justify-center"
:class="{
'flex max-h-20': !isHomePage,
}"
>
<div
class="w-5/6 flex justify-between items-center"
:class="{ 'h-screen': isHomePage }"
>
<router-link to="/" :class="{ 'flex space-x-2 items-end': !isHomePage }">
<div
class="text-3xl font-semibold transition-all absolute duration-1000 left-1/2 top-1/3 -translate-y-4"
:class="{
'relative !translate-y-0 !translate-x-0 left-0 top-0': !isHomePage,
}"
>
Aby
</div>
<div
class="text-2xl font-medium transition-all duration-1000 absolute left-1/2 top-1/3 translate-y-4 -translate-x-4"
:class="{
'relative !translate-y-0 !translate-x-0 left-0 top-0': !isHomePage,
}"
>
Isakov
</div>
</router-link>
<router-link to="/other">click</router-link>
</div>
</header>
</template>
While I initially tried positioning the navbar items absolutely, it caused issues with responsiveness of the component.