Floating Text with Refraction Effect

Written by @kerixa 26 May 2020

Immerse your texts in the sea and let the message goes deep in the mind! This is not a philosophical sentence, but a beautiful effect to make your texts influencing!

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.htmlbestcodes.com coded by: Kerixa Inc. -->
<meta name="viewport" content="width=device-width, initial-scale=1"><link href="https://fonts.googleapis.com/css?family=Roboto:700" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #3f81b3 url(https://www.htmlbestcodes.com/files/23-water.jpg) no-repeat center;
	background-size: cover;
    overflow: hidden;
}

h1 {
    position: relative;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: calc(10px + 10vw);
    font-weight: 700;
    color: #f5f5f5;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    perspective: 500px;
}

h1::before,
h1::after {
    content: attr(aria-label);
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    text-shadow: 0.01em 0.01em 0.01em rgba(0, 0, 0, 0.3);
}

h1::before {
    animation: floatAbove 3.5s ease-in-out infinite;
    -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 50%, 0% 50%);
            clip-path: polygon(0% 0%, 100% 0%, 100% 50%, 0% 50%);
}

h1::after {
    opacity: 0.65;
    filter: blur(0.02em);
    transform: translate(-50%, -50%) rotateX(21deg);
    animation: floatBelow 3.5s ease-in-out infinite;
    -webkit-clip-path: polygon(0% 50%, 100% 50%, 100% 100%, 0% 100%);
            clip-path: polygon(0% 50%, 100% 50%, 100% 100%, 0% 100%);
}

@keyframes floatAbove {
    50% {
        transform: translate(-50%, -60%);
        -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 60%, 0% 60%);
                clip-path: polygon(0% 0%, 100% 0%, 100% 60%, 0% 60%);
    }
}

@keyframes floatBelow {
    50% {
        transform: translate(-50%, -60%) rotateX(10deg);
        -webkit-clip-path: polygon(0% 60%, 100% 60%, 100% 100%, 0% 100%);
                clip-path: polygon(0% 60%, 100% 60%, 100% 100%, 0% 100%);
    }
}
</style>
<h1 aria-label="kerixa"></h1><a target='_blank' href='https://www.htmlbestcodes.com' style='font-size: 8pt; text-decoration: none'>Html Best Codes</a>                                                
                                            

Example:


About @kerixa

I am Krishna Eydat. I studied Software Engineering at University of Waterloo in Canada. I lead a few tech companies. I am passionate about the way we are connected. I would like to be part of something big or be the big deal!

K

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: sahjahan, fk khan, Proper, Jenisha, Mr Joseph Charles
advertisement 2