CSS Introduction

CSS Tutorial What is CSS CSS Syntax CSS Selector How to include CSS CSS Comments

CSS Attributes

CSS Background CSS Border CSS Display CSS Float CSS Font CSS Color CSS Hover CSS Important CSS Line-height CSS Margin CSS Opacity CSS Filter CSS Images CSS Overflow CSS Padding CSS Position CSS Vertical align CSS White space CSS Width Word-wrap in CSS Box-shadow in CSS Text-transform in CSS CSS Outline CSS Visibility CSS Counters CSS Clear fix CSS Icons CSS Justify-content Text-decoration in CSS CSS Lists CSS nth selector CSS Sticky CSS Background-clip CSS Checkbox-style CSS Letter-spacing CSS Navigation bar CSS Overlay CSS Root CSS Specificity CSS Text-indent CSS Text-stroke CSS Zoom CSS Order CSS Descendent selector CSS Clip CSS calc() CSS Background-blend-mode CSS radio-button CSS Superscript and subscript CSS Text-effects CSS Text-align CSS Variables CSS Page-break-before CSS Page-break-inside CSS Page-break-after CSS Content property CSS Word-spacing CSS Animation CSS @keyframes rules CSS Pseudo-classes CSS Pseudo-elements CSS Radial-gradient CSS Translate CSS Gradients CSS z-index CSS Loaders CSS Units CSS Transition CSS Masking CSS Arrow CSS Pagination

Questions

What is Bootstrap CSS What is CSS used for How to center a table in CSS What is a CSS File How to center a button in CSS How to change background color in CSS How to change the font in CSS How to change font size in CSS How to resize an image in CSS How to get rid of bullet pioints in CSS Is CSS a programming language How to edit CSS in WordPress How to use google fonts in CSS How to create blinking text using CSS How to Set Space between the Flexbox Is CSS a Programming Language

Difference

Difference between HTML and CSS Grid Vs Flexbox in CSS Difference between CSS Grid and CSS Flexbox

Misc

Create a 3D text effect using HTML and CSS Hover condition for a:before and a:after in CSS Bem CSS Boder Types CSS Features of CSS Font Face CSS Image Overlay CSS B Tag CSS Carousel CSS CSS Arrow CSS Focus Flex Grow in CSS Bem CSS Features of CSS Font Face CSS

Create a 3D text effect using HTML and CSS

A3D text effect is a beautiful and attractive part of a webpage. As a web page developer, it is crucial to know how to create a 3D text effect with the help of HTML and CSS. The full form of HTML is HyperText Markup Language. The full form of CSS is Cascading Style Sheet. To create 3D text effect is one of the attractive, easy and simple methods.

Approach

This effect is designed by the text-shadow development. The main thing behind this article is to give the web page 3D look. 

HTML code-

In this portion, we give <h1> tag to the word we will provide 3D design.

<!DOCTYPE html>
<html lang="en">


<body>
<h1>javaTpoint</h1>
</body>


</html>

CSS code-

*,
*::before,
*::after {
 box-sizing: border-box;
}


:root {
 --color-primary: #f6aca2;
 --color-secondary: #f49b90;
 --color-tertiary: #f28b7d;
 --color-quaternary: #f07a6a;
 --color-quinary: #ee6352;
 /*
 --color-primary: #5192ED;
 --color-secondary: #69A1F0;
 --color-tertiary: #7EAEF2;
 --color-quaternary: #90BAF5;
 --color-quinary: #A2C4F5;
 */
}


body {
 min-height: 100vh;
 font-family: canada-type-gibson, sans-serif;
 font-weight: 300;
 font-size: 1.25rem;
 display: flex;
 flex-direction: column;
 justify-content: center;
 overflow: hidden;
 background-color: #eff8e2;
}


.content {
 display: flex;
 align-content: center;
 justify-content: center;
}


.text_shadows {
 text-shadow: 3px 3px 0 var(--color-secondary), 6px 6px 0 var(--color-tertiary),
 9px 9px var(--color-quaternary), 12px 12px 0 var(--color-quinary);
 font-family: bungee, sans-serif;
 font-weight: 400;
 text-transform: uppercase;
 font-size: calc(2rem + 5vw);
 text-align: center;
 margin: 0;
 color: var(--color-primary);
 //color: transparent;
 //background-color: white;
 //background-clip: text;
 animation: shadows 1.2s ease-in infinite, move 1.2s ease-in infinite;
 letter-spacing: 0.4rem;
}


@keyframes shadows {
 0% {
 text-shadow: none;
 }
 10% {
 text-shadow: 3px 3px 0 var(--color-secondary);
 }
 20% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary);
 }
 30% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary), 9px 9px var(--color-quaternary);
 }
 40% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary), 9px 9px var(--color-quaternary),
 12px 12px 0 var(--color-quinary);
 }
 50% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary), 9px 9px var(--color-quaternary),
 12px 12px 0 var(--color-quinary);
 }
 60% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary), 9px 9px var(--color-quaternary),
 12px 12px 0 var(--color-quinary);
 }
 70% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary), 9px 9px var(--color-quaternary);
 }
 80% {
 text-shadow: 3px 3px 0 var(--color-secondary),
 6px 6px 0 var(--color-tertiary);
 }
 90% {
 text-shadow: 3px 3px 0 var(--color-secondary);
 }
 100% {
 text-shadow: none;
 }
}


@keyframes move {
 0% {
 transform: translate(0px, 0px);
 }
 40% {
 transform: translate(-12px, -12px);
 }
 50% {
 transform: translate(-12px, -12px);
 }
 60% {
 transform: translate(-12px, -12px);
 }
 100% {
 transform: translate(0px, 0px);
 }
}

Output:

Create a 3D text effect using HTML and CSS

Example 2-

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>


<style media="screen">
body {
background-color: #444;
font-family: sans-serif;
}
div {
width: 800px;
height: 100px;
margin: 200px auto;
perspective: 1000px;
perspective-origin: 50% -200px;
}
h1 {
text-align: center;
text-transform: uppercase;
font-size: 4em;
letter-spacing: 0.1em;
color: #EEE;
animation: rotate 2s ease-in-out alternate infinite;
}
h1:before {
content: attr(data-shadow);
color: transparent;
text-shadow: 0 0 15px #111;
position: absolute;
z-index: -1;
margin: -0.1em 0 0 0;
animation: skew 2s ease-in-out alternate infinite;
transform-origin: bottom;
}
@keyframes rotate {
from {
transform: rotateY(-10deg);
text-shadow: 1px -1px #CCC,
2px -1px #BBB,
3px -2px #AAA,
4px -2px #999,
5px -3px #888,
6px -3px #777;
}
to {
transform: rotateY(10deg);
text-shadow: -1px -1px #CCC,
-2px -1px #BBB,
-3px -2px #AAA,
-4px -2px #999,
-5px -3px #888,
-6px -3px #777;
}
}
@keyframes skew {
from {
transform: scaleY(0.3) skewX(-15deg);
}
to {
transform: scaleY(0.3) skewX(-20deg);
}
}


</style>
</head>
<body>
<div>
<h1 data-shadow="3D Text Effect">
3D Text Effect
</h1>
</div>


</body>
</html>

Output:

Create a 3D text effect using HTML and CSS