Вариант 1:
3D текст
1 2 3 |
<div class="text3d-wrap-1"> <span class="text3d-1">3D текст</span> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
.text3d-wrap-1 { margin: 0; padding: 0; background-color: #337AB7; position: relative; width: 100%; height: 260px; display: flex; flex-direction: row; justify-content: center; perspective: 3000px; } .text3d-1 { align-self: center; margin-top: -18px; transition: all 0.3s ease; transform: rotateX(40deg) rotateZ(5deg); font-family: Impact, Charcoal, sans-serif; font-size: 100px; letter-spacing: 3px; color: #f5f5f5; text-shadow: white 0.006em 0.006em 0.007em, #9c9c9c 1px 1px 1px, #9c9c9c 1px 2px 1px, #9c9c9c 1px 3px 1px, #9c9c9c 1px 4px 1px, #9c9c9c 1px 5px 1px, #9c9c9c 1px 6px 1px, #9c9c9c 1px 7px 1px, #9c9c9c 1px 8px 1px, #9c9c9c 1px 9px 1px, #9c9c9c 1px 10px 1px, #9c9c9c 1px 11px 1px, #9c9c9c 1px 12px 1px, rgba(16, 16, 16, 0.4) 1px 18px 6px, rgba(16, 16, 16, 0.2) 1px 22px 10px, rgba(16, 16, 16, 0.2) 1px 26px 35px, rgba(16, 16, 16, 0.4) 1px 30px 65px; } .text3d-wrap-1:hover .text3d-1{ margin-top: -26px; text-shadow: white 0.006em 0.006em 0.007em, #9c9c9c 1px 1px 1px, #9c9c9c 1px 2px 1px, #9c9c9c 1px 3px 1px, #9c9c9c 1px 4px 1px, #9c9c9c 1px 5px 1px, #9c9c9c 1px 6px 1px, #9c9c9c 1px 7px 1px, #9c9c9c 1px 8px 1px, #9c9c9c 1px 9px 1px, #9c9c9c 1px 10px 1px, #9c9c9c 1px 11px 1px, #9c9c9c 1px 12px 1px, rgba(16, 16, 16, 0.4) 1px 38px 26px, rgba(16, 16, 16, 0.2) 1px 42px 30px, rgba(16, 16, 16, 0.2) 1px 46px 65px, rgba(16, 16, 16, 0.4) 1px 50px 95px; } @media (max-width:767px) { .text3d-1 { font-size: 60px; } } |
Вариант 2:
Текст в данном примере задается через CSS-свойство content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<div class="text3d-wrap-2"> <div class="text3d-2"> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> <div class="text3d-layer-2"></div> </div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
.text3d-wrap-2 { background-color: #337AB7; height: 260px; overflow: hidden; } .text3d-2 { margin: 0; padding: 0; position: relative; width: 100%; height: 160px; perspective: 2000px; transform-style: preserve-3d; } .text3d-layer-2 { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; transform: rotateY(20deg) rotateX(35deg) translateZ(0); animation: text3d-anim-2 2s infinite alternate linear; animation-fill-mode: forwards; animation-play-state: paused; } .text3d-layer-2:after { font-family: Impact, Charcoal, sans-serif; font-size: 100px; content: '3D текст'; letter-spacing: 2px; text-align: center; height: 100%; width: 100%; position: absolute; top: 58px; color: #FFF; text-shadow: 4px 0 10px rgba(0, 0, 0, 0.13); } .text3d-layer-2:nth-child(1):after { transform: translateZ(0px); } .text3d-layer-2:nth-child(2):after { transform: translateZ(-1.5px); } .text3d-layer-2:nth-child(3):after { transform: translateZ(-3px); } .text3d-layer-2:nth-child(4):after { transform: translateZ(-4.5px); } .text3d-layer-2:nth-child(5):after { transform: translateZ(-6px); } .text3d-layer-2:nth-child(6):after { transform: translateZ(-7.5px); } .text3d-layer-2:nth-child(7):after { transform: translateZ(-9px); } .text3d-layer-2:nth-child(8):after { transform: translateZ(-10.5px); } .text3d-layer-2:nth-child(9):after { transform: translateZ(-12px); } .text3d-layer-2:nth-child(10):after { transform: translateZ(-13.5px); } .text3d-layer-2:nth-child(11):after { transform: translateZ(-15px); } .text3d-layer-2:nth-child(12):after { transform: translateZ(-16.5px); } .text3d-layer-2:nth-child(13):after { transform: translateZ(-18px); } .text3d-layer-2:nth-child(14):after { transform: translateZ(-19.5px); } .text3d-layer-2:nth-child(15):after { transform: translateZ(-21px); } .text3d-layer-2:nth-child(16):after { transform: translateZ(-22.5px); } .text3d-layer-2:nth-child(17):after { transform: translateZ(-24px); } .text3d-layer-2:nth-child(18):after { transform: translateZ(-25.5px); } .text3d-layer-2:nth-child(19):after { transform: translateZ(-27px); } .text3d-layer-2:nth-child(20):after { transform: translateZ(-28.5px); } .text3d-layer-2:nth-child(n+10):after { -webkit-text-stroke: 3px rgba(0, 0, 0, 0.25); } .text3d-layer-2:nth-child(n+11):after { -webkit-text-stroke: 15px #BFE2FF; text-shadow: 6px 0 6px #00366b, 5px 5px 5px #002951, 0 6px 6px #00366b; } .text3d-layer-2:nth-child(n+12):after { -webkit-text-stroke: 15px #68baff; } .text3d-layer-2:last-child:after { -webkit-text-stroke: 17px rgba(0, 0, 0, 0.1); } .text3d-layer-2:first-child:after { color: #fff; text-shadow: none; } .text3d-wrap-2:hover .text3d-layer-2 { animation-play-state: running; } @media (max-width:767px) { .text3d-2 .text3d-layer-2:after{ font-size: 60px; } } @keyframes text3d-anim-2 { 0 { transform: rotateY(20deg) rotateX(35deg) translateZ(0); } 50% { transform: rotateY(0) rotateX(-20deg) translateZ(0); } 100% { transform: rotateY(-20deg) rotateX(35deg) translateZ(0); } } |
Вариант 3:
3D текст
1 2 3 |
<div class="text3d-wrap-3"> <span class="text3d-3">3D текст</span> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
.text3d-wrap-3 { margin: 0; padding: 0; background-color: #337AB7; position: relative; width: 100%; height: 260px; display: flex; flex-direction: row; justify-content: center; } .text3d-3 { margin-top: -12px; align-self: center; transform: perspective(300px) rotateX(15deg) scaleY(0.8); transition: all 0.5s; font-family: Impact, Charcoal, sans-serif; font-size: 90px; letter-spacing: 3px; color: #FFF; text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 10px 0 #BFE2FF; } .text3d-wrap-3:hover .text3d-3 { transform: perspective(1000px) rotateX(15deg) scale(1.07); text-shadow: 0 0 10px black, 0 2px 0 #BFE2FF; } @media (max-width:767px) { .text3d-3 { font-size: 60px; } } |
Добавить комментарий: