Using text shadow and element shadow effects in CSS

Using text shadow and element shadow effects in CSS

Introduction to Text Shadows

  • In CSS , use the text-shadow property to set the text shadow. This property has a total of 4 attribute values: horizontal shadow, vertical shadow, (clarity or blur distance), and shadow color.
  • text-shadow property value description, in text shadow practice: the first value is to set the horizontal movement of the shadow, the second value is to set the vertical movement of the shadow, the third value is to set the shadow blur distance, and the fourth value is to set the shadow color.
  • text-shadow property value can be set to a negative number.
  • You can set multiple shadows for text by separating them with commas.
text-shadow: 1px 2px 3px red ,1px 2px 6px rebeccapurple;

Text shadow practice

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

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Text Shadow</title>
  <style>  
    div{
      font-size: 60px;
      color: seagreen;
      text-shadow: 1px 2px 3px red;
    }
  </style>
</head>

<body>
   <div>Smile is the original belief, come on. </div>
</body>

</html> 

Introduction to Elemental Shadows

Use box-shadow property in CSS to set a shadow on an element.

  • box-shadow property value description is as follows: the first value is to set the horizontal movement of the shadow, the second value is to set the vertical movement, the third value is to set the shadow clarity, the fourth value is to set the shadow size, the fifth value is to set the shadow color, and the sixth value is to set the shadow position. The default shadow position is outside, and inset sets the shadow to the inside.
  • box-shadow property value can be set to a negative number.
  • box-shadow property value can set multiple shadows by separating them with commas.

Elemental Shadow Practice

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

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Element Shadow</title>
  <style>  
    div{
      width: 100px;
      height: 100px;
      border: 2px solid red;
      box-shadow: 3px 6px 8px darkblue ,4px 8px 6px rebeccapurple inset;
    }
  </style>
</head>

<body>
   <div>Smile is the original belief, come on. </div>
</body>

</html> 

Summarize

The above is what I introduced to you about using text shadow and element shadow effects in CSS. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

<<:  Detailed steps for installing rockerChat in docker and setting up a chat room

>>:  select the best presets to create full compatibility with all browsersselect

Recommend

How to build a virtual machine with vagrant+virtualBox

1. Introduction Vagrant is a tool for building an...

MySQL binlog opening steps

Binlog is a binary log file that is used to recor...

How does MySQL achieve master-slave synchronization?

Master-slave synchronization, also called master-...

The url value of the src or css background image is the base64 encoded code

You may have noticed that the src or CSS backgroun...

Use Vue3 to implement a component that can be called with js

Table of contents Preface 1. Conventional Vue com...

Detailed explanation of how to use the calendar plugin implemented in Vue.js

The function to be implemented today is the follo...

jQuery combined with CSS to achieve the return to top function

CSS Operations CSS $("").css(name|pro|[...

How does Vue3's dynamic components work?

Table of contents 1. Component Registration 1.1 G...

Binary Type Operations in MySQL

This article mainly introduces the binary type op...

Detailed explanation of virtual DOM in Vue source code analysis

Why do we need virtual dom? Virtual DOM is design...

Using JS to determine the existence of elements in an array in ten minutes

Preface In front-end development, you often need ...

MySQL SQL Optimization Tutorial: IN and RANGE Queries

First, let's talk about the in() query. It is...

How to modify mysql to allow remote connections

Regarding the issue of MySQL remote connection, w...

js to achieve interesting countdown effect

js interesting countdown case, for your reference...