Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

CSS Make text background height size increase animation

How should I animate text (with writing-mode set to vertical-rl) background in CSS to increase its height when you hover over it? Something like this: https://youtu.be/A_ZS3aE_8Bw
Thanks!

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#text {
    --width: 2rem;
    font-size: var(--width);
    writing-mode: vertical-rl;
    position: relative;
}

#text::before {
    content: "";
    position: absolute;
    width: var(--width);
    height: 0;
    background-color: red;
    z-index: -1;
    transition: all 0.3s ease-in-out;
}

#text:hover::before {
    height: 10rem;
}
    <div id="text">hello world!</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading