text-shadow

revision:


Content

defintion and usage syntax examples


defintion and usage

top

The text-shadow CSS property adds shadow to text. In its simplest use, you only specify the horizontal shadow (..px) and the vertical shadow (..px).

It accepts a comma-separated list of shadows to be applied to the text and any of its decorations. Each shadow is described by some combination of X and Y offsets from the element, blur radius, and color.

Each shadow is specified as two or three "length" values, followed optionally by a "color" value. The first two "length" values are the "offset-x" and "offset-y" values. The third - optional - "length" value is the "blur-radius". The "color" value is the shadow's color.

When more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top.

This property applies to both "::first-line" and "::first-letter" pseudo-elements.


syntax

top

text-shadow: offset-x | offset-y | blur-radius | color | none | initial | inherit;

property values:

off-set x, offset-y: required; these "length" values specify the shadow's distance from the text.

<offset-x> specifies the horizontal distance; a negative value places the shadow to the left of the text.
<offset-y> specifies the vertical distance; a negative value places the shadow above the text.
If both values are 0, the shadow is placed directly behind the text, although it may be partly visible due to the effect of <blur-radius>.

color: optional; the color of the shadow; it can be specified either before or after the offset values; if unspecified, the color's value is left up to the user agent; so when consistency across browsers is desired you should define it explicitly.

blur-radius: optional; this is a "length" value; the higher the value, the bigger the blur; the shadow becomes wider and lighter. If not specified, it defaults to 0.

none: default value; no shadow.

initial: sets this property to its default value.

inherit: inherits this property from its parent element.

syntax examples:

/* offset-x | offset-y | blur-radius | color */
text-shadow: 1px 1px 2px black;

/* color | offset-x | offset-y | blur-radius */
text-shadow: #fc0 1px 0 10px;

/* offset-x | offset-y | color */
text-shadow: 5px 5px #558abb;

/* color | offset-x | offset-y */
text-shadow: white 2px 5px;

/* offset-x | offset-y
/* Use defaults for color and blur-radius */
text-shadow: 5px 10px;

/* Global values */
text-shadow: inherit;
text-shadow: initial;
text-shadow: revert;
text-shadow: unset;


examples

Text-shadow effect!

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore.

code:
            <div class="grid_A">
                <h3 class="one">Text-shadow effect!</h3>
                <p class="spec white-text-with-blue-shadow">Sed ut perspiciatis unde omnis iste  natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore.</p>
            </div>
            <style>
                .one {width: 40vw; text-shadow: 0.1vw 0.1vw;}
                .white-text-with-blue-shadow {width: 30vw; text-shadow: 1px 1px 2px black, 0 0 1vw blue, 0 0 0.2vw blue; color: red; font: 1.5vw Georgia, serif;}
            </style>
        

The best way to get started is to quit talking and begin doing.
The best way to get started is to quit talking and begin doing.
code:
            <div class="grid_A">
                <div class="one-a">The best way to get started is to quit talking and begin doing.</div>
                <div class="two">The best way to get started is to quit talking and begin doing.</div>
            </div>
            <style>
                .one-a{margin-left: 2vw; width:30vw; height:25vw; text-align: center; padding:1vw; font-size:3vw; background: #A0CBA4; color: #D5E2D6; font-family: 'Lobster'; text-shadow: #4A744D 1px 1px,
                #4A744D 0px 0px,#4A744D 1px 1px,#4A744D 2px 2px,#4A744D 3px 3px,#4A744D 4px 4px,#4A744D 5px 5px,#4A744D 6px 6px,#4A744D 7px 7px,#4A744D 8px 8px,#4A744D 9px 9px,
                #4A744D 10px 10px,#4A744D 11px 11px,#4A744D 12px 12px,#4A744D 13px 13px,#4A744D 14px 14px,#4A744D 15px 15px,#4A744D 16px 16px,#4A744D 17px 17px,#4A744D 18px 18px,
                #4A744D 19px 19px,#4A744D 20px 20px,#4A744D 21px 21px,#4A744D 22px 22px,#4A744D 23px 23px,#4A744D 24px 24px,#4A744D 25px 25px,#4A744D 26px 26px,#4A744D 27px 27px,
                #4A744D 28px 28px,#4A744D 29px 29px;}
                .two{margin-left: 0vw; width:30vw; height:25vw; text-align: center; padding: 1vw; font-size:3vw; background: #e74c3c; color: #fff; font-family: lato; 
                    text-shadow: 1px 1px rgba(123, 25, 15, 0.5), 2px 2px rgba(129, 28, 18, 0.51), 3px 3px rgba(135, 31, 20, 0.52), 4px 4px rgba(140, 33, 22, 0.53), 5px 5px rgba(145, 36, 24, 0.54), 
                    6px 6px rgba(150, 38, 26, 0.55), 7px 7px rgba(154, 40, 28, 0.56), 8px 8px rgba(158, 42, 30, 0.57), 9px 9px rgba(162, 44, 31, 0.58), 10px 10px rgba(166, 45, 33, 0.59), 11px 11px 
                    rgba(169, 47, 34, 0.6), 12px 12px rgba(173, 48, 36, 0.61), 13px 13px rgba(176, 50, 37, 0.62), 14px 14px rgba(178, 51, 38, 0.63), 15px 15px rgba(181, 52, 39, 0.64), 16px 16px
                     rgba(184, 54, 40, 0.65), 17px 17px rgba(186, 55, 41, 0.66),18px 18px rgba(189, 56, 42, 0.67), 19px 19px rgba(191, 57, 43, 0.68), 20px 20px rgba(193, 58, 44, 0.69), 21px 21px
                     rgba(195, 59, 45, 0.7), 22px 22px rgba(197, 60, 46, 0.71), 23px 23px rgba(199, 61, 47, 0.72), 24px 24px rgba(201, 62, 47, 0.73), 25px 25px rgba(202, 62, 48, 0.74), 26px 26px 
                     rgba(204, 63, 49, 0.75), 27px 27px rgba(206, 64, 49, 0.76), 28px 28px rgba(207, 65, 50, 0.77), 29px 29px rgba(209, 65, 51, 0.78), 30px 30px rgba(210, 66, 51, 0.79), 31px 31px 
                     rgba(211, 67, 52, 0.8), 32px 32px rgba(213, 67, 52, 0.81), 33px 33px rgba(214, 68, 53, 0.82), 34px 34px rgba(215, 69, 53, 0.83), 35px 35px rgba(216, 69, 54, 0.84), 36px 36px 
                     rgba(218, 70, 54, 0.85), 37px 37px rgba(219, 70, 55, 0.86), 38px 38px rgba(220, 71, 55, 0.87), 39px 39px rgba(221, 71, 56, 0.88), 40px 40px rgba(222, 72, 56, 0.89), 41px 41px 
                     rgba(223, 72, 57, 0.9), 42px 42px rgba(224, 73, 57, 0.91), 43px 43px rgba(225, 73, 57, 0.92), 44px 44px rgba(225, 73, 58, 0.93), 45px 45px rgba(226, 74, 58, 0.94), 46px 46px 
                     rgba(227, 74, 58, 0.95), 47px 47px rgba(228, 75, 59, 0.96), 48px 48px rgba(229, 75, 59, 0.97), 49px 49px rgba(230, 75, 59, 0.98), 50px 50px rgba(230, 76, 60, 0.99);}
            </style>
        </pre>
    

Play
at
Your
own
Risk

code:
                    <style>
                        .content{background: #A0CBA4; font-family: Helvetica, 'Lobster', cursive; width: 90vw; height: 35vw; margin: 0 auto;}
                        .circle {margin-left: 30vw; margin-top: 5vw;height: 20vw;width: 20vw; border-radius: 100%; background: #4E8953; }
                        .circle h3 {color: #D5E2D6; text-align: center; line-height: 4vw; margin-top: -4vw; -moz-transform: scale(1) rotate(-5deg) translateX(0vw) translateY(0vw) skewX(1deg) skewY(1deg);
                            -webkit-transform: scale(1) rotate(-5deg) translateX(0vw) translateY(0vw) skewX(1deg) skewY(1deg);-o-transform: scale(1) rotate(-5deg) translateX(0vw) translateY(0vw) skewX(1deg)
                             skewY(1deg);-ms-transform: scale(1) rotate(-5deg) translateX(0vw) translateY(0vw) skewX(1deg) skewY(1deg);transform: scale(1) rotate(-5deg) translateX(0vw) translateY(0vw) 
                             skewX(1deg) skewY(1deg);
                        /*-----------------------*/
                        text-shadow: 1px 1px #4A744D, 2px 2px #4A744D, 3px 3px #4A744D, 4px 4px #4A744D, 5px 5px #4A744D, 6px 6px #4A744D, 7px 7px #4A744D, 8px 8px #4A744D, 9px 9px #4A744D, 10px 10px 
                        #4A744D,11px 11px #4A744D, 12px 12px #4A744D, 13px 13px #4A744D, 14px 14px #4A744D, 15px 15px #4A744D, 16px 16px #4A744D, 17px 17px #4A744D, 18px 18px #4A744D, 
                        19px 19px #4A744D, 20px 20px #4A744D, 21px 21px #4A744D, 22px 22px #4A744D, 23px 23px #4A744D, 24px 24px #4A744D, 25px 25px #4A744D, 26px 26px 6px #06520C;}
                        span:nth-child(3), span:nth-child(7) {font-size: 6vw;}
                        span:nth-child(1), span:nth-child(9), span:nth-child(5){font-size: 10vw;}
                    </style>
                    <div class="content">
                        <div class="circle">
                            <h3><span>Play</span><br/><span>at</span><br/><span>Your</span><br/><span>own</span><br/><span>Risk</span></h3>
                        </div>
                    </div>
                

Hello World!

FIELDING

code:
            <div class="grid_A">
                <div class="three">
                    <h4 class="word">Hello World!</h4>
                </div>
                <div class="initial">
                    <h4 class="four">FIELDING</h4>
                </div>
            </div>
            <style>                                
                .three{margin: 2vw 0 0 2vw; background: white; width: 40vw; height: 40vw;}
                .three h4{font-family: sans-serif; text-transform: uppercase; font-size: 4vw; text-align: center; font-weight: normal; margin: 0; top: 50%; left: 50%; transform: translate(-50%, -50%); 
                    position: relative; color: white; letter-spacing: .6vw; text-shadow: 2vw 2vw 4vw black, 2vw 2vw 4vw pink; transition: all 1s ease-out;}
                .three h4:hover {text-shadow: -2vw 2vw 4vw black, -2vw 2vw 4vw pink; cursor:pointer;}
                .initial{margin: 2vw; background-color: #fc3153; text-align: center; width:40vw; height: 40vw;}
                .four{font-size: 5vw; font-family: 'Luckiest Guy'; color: #fff;-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-shadow: 0px -6px 0 #212121,  
                    0px -6px 0 #212121,
                    0px  6px 0 #212121,
                    0px  6px 0 #212121,
                    -6px  0px 0 #212121,  
                    6px  0px 0 #212121,
                    -6px  0px 0 #212121,
                    6px  0px 0 #212121,
                    -6px -6px 0 #212121,  
                    6px -6px 0 #212121,
                    -6px  6px 0 #212121,
                    6px  6px 0 #212121,
                    -6px  18px 0 #212121,
                    0px  18px 0 #212121,
                    6px  18px 0 #212121,
                    0 19px 1px rgba(0,0,0,.1),
                    0 0 6px rgba(0,0,0,.1),
                    0 6px 3px rgba(0,0,0,.3),
                    0 12px 6px rgba(0,0,0,.2),
                    0 18px 18px rgba(0,0,0,.25),
                    0 24px 24px rgba(0,0,0,.2),
                    0 36px 36px rgba(0,0,0,.15);}
            </style>