@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap");
body {
background-color: black;
margin: 0;
padding: 0;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.word {
transition: 0.3s;
opacity: 1;
}
p,
a {
color: #fff;
font-size: 5vw;
font-family: "Rubik", sans-serif;
text-transform: uppercase;
margin: 0;
text-decoration: none;
letter-spacing: 2px;
}
.line {
display: flex;
justify-content: space-between;
}
.fancy {
cursor: pointer;
}
#txt:has(.fancy:hover) .word:not(.fancy:hover) {
opacity: 0.2;
}
.letter {
display: inline-block;
transition: all 0.6s ease;
}
.fancy:hover .letter:nth-child(1) {
transform: translate(-40%, 60%) rotate(8deg);
}
.fancy:hover .letter:nth-child(2) {
transform: translate(20%, -60%) rotate(0deg);
}
.fancy:hover .letter:nth-child(3) {
transform: translate(-70%, 80%) rotate(-3deg);
}
.fancy:hover .letter:nth-child(4) {
transform: translate(-30%, -45%) rotate(3deg);
}
.fancy:hover .letter:nth-child(5) {
transform: translate(0%, 20%) rotate(7deg);
}
.fancy:hover .letter:nth-child(6) {
transform: translate(10%, 30%) rotate(2deg);
}
.fancy:hover .letter:nth-child(7) {
transform: translate(20%, 60%) rotate(3deg);
}
.fancy:hover .letter:nth-child(8) {
transform: translate(-20%, 30%) rotate(4deg);
}
.fancy:hover .letter:nth-child(9) {
transform: translate(69%, 0%) rotate(-3deg);
}
.fancy:hover .letter:nth-child(10) {
transform: translate(12%, 18%) rotate(5deg);
}
.fancy:hover .letter:nth-child(11) {
transform: translate(15%, -10%) rotate(-5deg);
}
.fancy:hover .letter:nth-child(12) {
transform: translate(0%, 60%) rotate(9deg);
}
<div id="txt">
<div class="line">
<p class="word">A</p>
<p class="word">Person</p>
</div>
<div class="line">
<p class="word">Youtube</p>
<p class="word">&</p>
</div>
<div class="line">
<a id="yt-link" href="www.youtube.com" class="word fancy" target="_blank"><span class="letter">C</span><span class="letter">o</span><span class="letter">d</span><span class="letter">e</span><span class="letter">p</span><span class="letter">e</span><span class="letter">n</span><span class="letter">d</span><span class="letter">e</span><span class="letter">n</span><span class="letter">c</span><span class="letter">e</span></a
>
</div>
<div class="line">
<a
id="yt-link"
href="www.youtube.com"
class="word fancy"
target="_blank"
><span class="letter">@</span><span class="letter">h</span><span class="letter">y</span><span class="letter">p</span><span class="letter">e</span><span class="letter">r</span><span class="letter">p</span><span class="letter">l</span><span class="letter">e</span><span class="letter">x</span><span class="letter">e</span><span class="letter">d</span></a>
</div>
</div>
To create a unique floating effect for each letter, you can add an animation after the transform transition. However, as a beginner in front-end development, you may encounter some challenges with this.
Adding the animation requires careful handling of the letter positions to maintain their transformed state. If they return to their original position, try adjusting the animation properties and timing.
Keep practicing and experimenting with different techniques to enhance your skills in front-end design!