Tạo hiệu ứng chữ 3D với thuộc tính text-shadow của css.
Code CSS
Code CSS
Bài viết sẽ được bổ sung thêm nhiều hiệu ứng sau.
3D Text đơn giản
Code HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>TranDucIT.Com</title> </head> <body> <h1>TranDucIT.Com</h1> </body> </html>
Code CSS
body { font: 900 80px/1 'Source Sans Pro', Arial, sans-serif; background: #becccc;color: #fff; text-align: center; letter-spacing: -3px; padding-top: 10%; } h1 { position: absolute; top: 20%; width: 100%; text-shadow:0 1px 0 hsl(174,5%,80%), 0 2px 0 hsl(174,5%,75%), 0 3px 0 hsl(174,5%,70%), 0 4px 0 hsl(174,5%,66%), 0 5px 0 hsl(174,5%,64%), 0 6px 0 hsl(174,5%,62%), 0 7px 0 hsl(174,5%,61%), 0 8px 0 hsl(174,5%,60%), 0 0 5px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.2), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.2), 0 10px 10px rgba(0,0,0,.2), 0 20px 20px rgba(0,0,0,.3); }
3D Text Lighting
Code HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>TranDucIT.Com</title> </head> <body> <h1 id="text3d">TranDucIT.Com</h1> </body> </html>
Code CSS
html { height: 100%; } body { overflow: hidden; margin: 0; padding: 0; background: rgba(206,188,155,1); background: -moz-linear-gradient(-45deg, rgba(206,188,155,1) 0%, rgba(85,63,50,1) 51%, rgba(42,31,25,1) 100%); background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(206,188,155,1)), color-stop(51%, rgba(85,63,50,1)), color-stop(100%, rgba(42,31,25,1))); background: -webkit-linear-gradient(-45deg, rgba(206,188,155,1) 0%, rgba(85,63,50,1) 51%, rgba(42,31,25,1) 100%); background: -o-linear-gradient(-45deg, rgba(206,188,155,1) 0%, rgba(85,63,50,1) 51%, rgba(42,31,25,1) 100%); background: -ms-linear-gradient(-45deg, rgba(206,188,155,1) 0%, rgba(85,63,50,1) 51%, rgba(42,31,25,1) 100%); background: linear-gradient(135deg, rgba(206,188,155,1) 0%, rgba(85,63,50,1) 51%, rgba(42,31,25,1) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cebc9b', endColorstr='#2a1f19', GradientType=1 ); } h1 { width: 100%; margin: 0 auto 0 auto; font-family: 'Lato', sans-serif; line-height: 280px; font-size: 10rem; padding: 80px 50px; text-align: center; text-rendering: optimizeLegibility; } h1::before { content:""; width: 100%; height: 750px; position: absolute; top: -200px; left: 10px; transform: rotate(55deg); background: rgba(206,188,155,.7); background: -moz-linear-gradient(left, rgba(206,188,155,.7) 0%, rgba(42,31,25,0) 65%); background: -webkit-gradient(left top, right top, color-stop(0%, rgba(206,188,155,.7)), color-stop(65%, rgba(42,31,25,0))); background: -webkit-linear-gradient(left, rgba(206,188,155,.7) 0%, rgba(42,31,25,0) 65%); background: -o-linear-gradient(left, rgba(206,188,155,.7) 0%, rgba(42,31,25,0) 65%); background: -ms-linear-gradient(left, rgba(206,188,155,.7) 0%, rgba(42,31,25,0) 65%); background: linear-gradient(to right, rgba(206,188,155,.7) 0%, rgba(42,31,25,0) 65%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cebc9b', endColorstr='#2a1f19', GradientType=0.7 ); ); } #text3d { color: #70869d; text-shadow: -1px -1px 1px #efede3, 0px 1px 0 #2e2e2e, 0px 2px 0 #2c2c2c, 0px 3px 0 #2a2a2a, 0px 4px 0 #282828, 0px 5px 0 #262626, 0px 6px 0 #242424, 0px 7px 0 #222, 0px 8px 0 #202020, 0px 9px 0 #1e1e1e, 0px 10px 0 #1c1c1c, 0px 11px 0 #1a1a1a, 0px 12px 0 #181818, 0px 13px 0 #161616, 0px 14px 0 #141414, 0px 15px 0 #121212, 2px 20px 5px rgba(0, 0, 0, 0.9), 5px 23px 5px rgba(0, 0, 0, 0.3), 8px 27px 8px rgba(0, 0, 0, 0.5), 8px 28px 35px rgba(0, 0, 0, 0.9); }
Bài viết sẽ được bổ sung thêm nhiều hiệu ứng sau.
Tác giả: TranDuc
Code: Codepen
Tổng hợp Code tạo chữ 3D bằng CSS (3D Text)
Reviewed by TranDuc
on
tháng 4 09, 2017
Rating:
Không có nhận xét nào: