In this chapter, we will know how to display animation in 3d text in web page with the help of html, css.
Example 1.1
<!DOCTYPE html> <html> <head> <title>amcodestar</title> <style> * { margin: 0; padding: 0; } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color:lightgray; } .text { font-family: verdana; transform:translate (50%,-50%); font-size:8em; color:white; text-shadow:1px 10px 1px gray, 1px 18px 6px rgba(255,0,0,0.8), 1px 22px 10px rgba(255,0,0,0.8); } h1 span { animation: animate 2s linear infinite; } h1 span:nth-child(1) { animation-delay: 0s; } h1 span:nth-child(2) { animation-delay: 0.2s; } h1 span:nth-child(3) { animation-delay: 0.4s; } h1 span:nth-child(4) { animation-delay: 0.6s; } h1 span:nth-child(5) { animation-delay: 0.8s; } @keyframes animate { 0%,80% { color: black; } 100% { color:white; text-shadow:0 0 10px white,; } } </style> </head> <body> <h1><span class="text">A</span> <span class="text">J</span> <span class="text">I</span> <span class="text">T</span> </h1> </body> </html> |
Output
Example 1.2
<!DOCTYPE html> <html> <head> <title>amcodestar</title> <style> * { margin: 0; padding: 0; } body { background-color:lightgray; display:flex; justify-content: center; align-items: center; min-height:100vh; } h1 { font-family: verdana; position: absolute; /*top:50%;*/ right:50%; transform:translate (50%,-50%); font-size:8em; color:#f5f5f5; text-shadow:1px 10px 1px gray, 1px 18px 6px rgba(255,0,0,0.8), 1px 22px 10px rgba(255,0,0,0.8); } h1::before { content: attr(data-text); position:absolute; top:0; left:0; width:0; color:green; border-right:2px solid green; overflow: hidden; animation: animate 4s linear infinite; } @keyframes animate { 0% { width:0; } 50% { width:100%; } } </style> </head> <body> <h1 data-text= "AMCODESTAR.COM"> AMCODESTAR.COM</h1> </body> </html> |
Output
Example 1.3
<!DOCTYPE HTML> <html> <head> <title>amcodestar</title> <style> * { margin:0; padding:0; } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; overflow: hidden; } .txt { color: black; font-size:8em; text-shadow:1px 10px 1px gray, 1px 18px 6px rgba(255,0,0,0.8), 1px 22px 10px rgba(255,0,0,0.8); } .gradient{ background: linear-gradient (130deg, rgba (6, 227, 250,1) 5%, rgba (229, 151, 64.1) 100%); position: absolute; top: 0; left:0; width: 100%; height:100%; mix-blend-mode: multiply; } .dodge { background: radial-gradient (circle,white,black 35%) center / 25% 25%; position: absolute; top:-100%; left:-100%; right:0; bottom:0; mix-blend-mode: color-dodge; animation: dodge-area 3s linear infinite; } @keyframes dodge-area { to { transform: translate (50%,50%); } } </style> </head> <body> <span class="txt" > AMCODESTAR</span> <span class="gradient"> </span> <span class="dodge"> </span> </body> </html> |
Output