Front-end web learning 11 (css box shadow and text shadow)

Box shadow:

Insert picture description here
Precautions:

1. The default is outset, but do not write, otherwise the shadow will be invalid
. 2. The box shadow does not occupy space and does not affect the web page layout

Code example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>盒子阴影</title>
    <style>
        div{
     
     
            width: 200px;
            height: 200px;
            background-color: blueviolet;
            margin: 300px auto;
            box-shadow: 30px 30px 10px 20px black;
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>

Webpage effect:
Insert picture description here
special application:
show shadow code example when the mouse passes over the box
:

div:hover{
    
    
            box-shadow: 30px 30px 10px 20px black;
        }

Text shadow:

Insert picture description here
Code example:

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文字阴影</title>
    <style>
        div {
     
     
            width: 200px;
            height: 200px;
            margin: 300px auto;
            font-size: 50px;
            font-weight: normal;
            text-shadow: 10px 10px 10px blue;
        }
    </style>
</head>

<body>
    <div>阴影</div>
</body>

</html>

Page performance:
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_40551957/article/details/113538946