


How to add text shadow effect in css3? text-shadow sets the text shadow effect
The shadow effect is a common and very practical effect. I believe that some friends sometimes have some questions when using the shadow effect to make the web page beautiful, such as: how to set the shadow of the font and text, etc. So this chapter will tell you how to set the font text shadow in CSS3. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
In fact, there is a very practical attribute in css3 that can add a shadow effect to font text, that is css3 text-shadow attribute.
So, let’s take a detailed look at the text-shadow attribute first:
Text-shadow is a CSS style attribute word, which is used to set whether the text font of the text in the object has a shadow and blur effect. CSS styles.
text-shadow attribute: In CSS3, you can use the text-shadow attribute to add a shadow effect to the text on the page. You can achieve some required font shadow effects by setting relevant attribute values to the text-shadow attribute. ,Reduce the use of pictures.
The syntax of the text-shadow attribute:
text-shadow: h-shadow v-shadow blur color;
It can be seen that the text-shadow attribute can set 4 parameters. Each parameter is separated by spaces. Let’s introduce these four parameters. :
h-shadow: Set the position of the horizontal shadow (x-axis direction), a required parameter; negative values are allowed.
v-shadow: Set the position of the vertical shadow (y-axis direction), required parameters, negative values allowed.
blur: The distance (radius size) of shadow blur, you can choose to set the parameters.
color: The color of the shadow, optional parameters to set.
Note: The text-shadow property can add one or more shadows to text. This property is a comma-separated list of shades, each shade specified with two or three length values and an optional color value. The omitted length is 0.
Let’s take a look at a small example of css3 setting font text shadow to get a concrete understanding of the usage of the text-shadow attribute:
<h1 id="我是一段测试文字">我是一段测试文字</h1>
h1{ color:powderblue; /*设置文字颜色*/ text-shadow: 2px 3px 1px pink;/*添加字体文字的阴影*/ }
Rendering:
Let’s take a look at what will happen if the css3 text shadow effect is not set:
Description:
1. The horizontal offset of the shadow (h-shadow): it can take a positive value or a negative value. If the value is positive, the shadow is on the right side of the object, and vice versa. When the value is negative, the shadow is to the left of the object.
2. The vertical offset of the shadow (v-shadow): It can take a positive value or a negative value. If it is a positive value, the shadow is at the bottom of the object. Otherwise, when the value is a negative value, the shadow on top of the object.
3. Shadow blur radius: can only be set to positive values. If the value is larger, the shadow will be blurry, otherwise the shadow will be clearer. If its value is 0, it means that the shadow has no blur effect.
4. Shadow color: When no color value is specified, the browser will use the default color, but the default color of each browser is different, especially Safari and Chrome browsers under the webkit kernel will not Color, that is, transparency, it is recommended not to omit this parameter.
Speaking of the different default colors of browsers, let’s take a look at whether the text-shadow attribute is supported in various browsers:
Browser support:
All major browsers support the text-shadow attribute.
Note: Internet Explorer 9 and earlier browsers do not support the text-shadow attribute.
The above is the detailed content of How to add text shadow effect in css3? text-shadow sets the text shadow effect. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale(x-axis magnification, y Axis magnification);}".

How to create text carousel and image carousel? The first thing everyone thinks of is whether to use js. In fact, text carousel and image carousel can also be realized using pure CSS. Let’s take a look at the implementation method. I hope it will be helpful to everyone!

In CSS3, you can use the "animation-timing-function" attribute to set the animation rotation speed. This attribute is used to specify how the animation will complete a cycle and set the speed curve of the animation. The syntax is "element {animation-timing-function: speed attribute value;}".

The animation effect in css3 has deformation; you can use "animation: animation attribute @keyframes ..{..{transform: transformation attribute}}" to achieve deformation animation effect. The animation attribute is used to set the animation style, and the transform attribute is used to set the deformation style. .
