css3-text shadow (text-shadow) and box shadow (box-shadow)

The really good-looking effects are all slowly tuned out under your own control. The following will introduce the specific content and methods of use:

CSS3 properties

Text shadow properties

  • text-shadow: xy shadow distance color

  • Note: The horizontal and vertical shadow positions allow negative values . Multiple shadow settings can be made (comma separated mode)

Box shadow

  box-shadow box-shadow

  h-shadow required. The location of the horizontal shadow. Allow negative values ​​for
  v-shadow required. The location of the vertical shadow. Allow negative values ​​to
  be optional. Blur distance
  spread is optional. The size of the shadow is
  optional. The color of the shadow.
  inset is optional. Change the inner shadow of the shadow from the outer shadow (at the beginning)
  box-shadow: 10px 10px 5px 10px # 888888 inset;

Short form:

  box-shadow: 10px 10px 5px 10px #888888 inset;

The case diagram is as follows:

 

The specific implementation code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 500px;
            margin: 40px auto;
            text-align: center;
        }
        .box p{
            font-size: 40px;
            color: #e6c9c9;
            text-shadow: -4px 0px 1px #000;
        }
        .shadow{
            background-color: #eee;
            width: 200px;
            height: 200px;
            margin: 20px auto;
            box-shadow: 0px 0px 10px #bd9c9c;
        }
    </style>
</head>
<body>
    <div class="box">
        <p> Text shadow properties </ p>
        <div class="shadow">

        </div>
    </div>
</body>
</html>
 
If you feel helpful to yourself, please pay attention to it and you will always share your knowledge. Thank you! ! !

Guess you like

Origin www.cnblogs.com/piaoyi1997/p/12742168.html