CSS Text Reflection Effects
02/02/2021
Contents
Demo
Code
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>CSS Text Reflection Effects</title>
<link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
<link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container">
<h1 class="text">TEXT</h1>
</div>
</body>
</html>
CSS
@charset "utf-8";
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 16px;
}
body {
background-color: #000;
font-family: futura-pt, sans-serif;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 100vh;
}
.text {
position: relative;
margin: 0;
color: #fff;
font-weight: 500;
font-size: 8em;
letter-spacing: 10px;
}
.text::before {
content: 'TEXT';
position: absolute;
top: -5px;
left: 0;
transform-origin: bottom;
transform: rotateX(180deg);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
background-image: linear-gradient(0, #777 0, transparent 68%);
line-height: .9;
}
@media screen and (max-width: 480px) {
.text {
font-size: 6rem;
}
}