Detailed explanation on the use of box-shadow attribute in CSS3
Every time you use box-shadow, you have to consult the information to achieve the corresponding effect. Let’s summarize it now for easy reference in the future.
1. Grammar:
## E {box-shadow: inset x-offset y-offset blur-radius spread-radius color}; E {box-shadow: Projection method :
1. Shadow type: This parameter is optional. The default projection method is outer shadow; if the only value "inset" is taken, the outer shadow will be changed into inner shadow;
2. Y-offset: refers to the vertical offset of the shadow. Its value can also be positive or negative. For positive values, the shadow is at the bottom of the object. For negative values, the shadow is at the top of the object; 4. Shadow Blur radius: This parameter is optional and can only be positive. If its value is 0, it means that the shadow does not have a blur effect. The larger the value, the blurr the edge of the shadow;
5. Shadow expansion radius : This parameter is optional, and its value can be positive or negative. If it is a positive value, the entire shadow will be expanded, otherwise, it will be reduced.
6. Shadow color: This parameter is optional. When no color is set, , the browser will take the default color, but the default color of each browser is different, especially the safari and chrome browsers under the webkit kernel will be colorless, that is, transparent. It is recommended not to omit this parameter.
3.
Compatible browser writing method:
<span style="color: #800000;"><span style="color: #000000;">//Firefox4.0-</span><br/><span style="color: #ff6600;">-moz-box-shadow:</span> <span style="color: #000000;">投影方式 X轴偏移量 Y轴偏移量 阴影模糊半径 阴影扩展半径 阴影颜色;</span><br/><span style="color: #000000;">//Safari and Google chrome10.0-</span><br/><span style="color: #ff6600;">-webkit-box-shadow:</span> <span style="color: #000000;">投影方式 X轴偏移量 Y轴偏移量 阴影模糊半径 阴影扩展半径 阴影颜色;</span><br/><span style="color: #000000;">//Firefox4.0+ 、 Google chrome 10.0+ 、 Oprea10.5+ and IE9</span><br/><span style="color: #ff6600;">box-shadow:</span> <span style="color: #000000;">投影方式 X轴偏移量 Y轴偏移量 阴影模糊半径 阴影扩展半径 阴影颜色;</span></span>
IE filter simulates box-shadow shadow effect
Basic syntax: filter:progid:DXImageTransform.Microsoft.Shadow(color='color value', Direction =Shadow angle (numeric value),Strength=Shadow radius (numeric value));
: 1. This filter must be used together with the background attribute, otherwise the The filter is invalid;
2. The color attributes in the filter must be written completely, and abbreviations cannot be used;3. The shadow of the filter is calculated within the width and height;
4. Under the box shadow, The box will automatically add overflow:hidden;5. Commonly used shadow implementation code
:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>box-shadow的用法</title> <style type="text/css"> p{ width:60px; height:60px; margin:40px auto; background-color: grey; } /*右下阴影*/ .box-shadow-1{ -webkit-box-shadow: 3px 3px 3px; -moz-box-shadow: 3px 3px 3px; box-shadow: 3px 3px 3px; } /*四边同色阴影*/ .box-shadow-2{ -webkit-box-shadow:0 0 10px #0CC; -moz-box-shadow:0 0 10px #0CC; box-shadow:0 0 10px #0CC; } /*四边同色阴影扩展*/ .box-shadow-3{ -webkit-box-shadow:0 0 10px 15px #0CC; -moz-box-shadow:0 0 10px 15px #0CC; box-shadow:0 0 10px 15px #0CC; } /*四边同色内阴影*/ .box-shadow-4{ -webkit-box-shadow:inset 0 0 10px #0CC; -moz-box-shadow:inset 0 0 10px #0CC; box-shadow:inset 0 0 10px #0CC; } /*四边异色外阴影*/ .box-shadow-5{ box-shadow:-10px 0 10px red, /*左边阴影*/ 10px 0 10px yellow, /*右边阴影*/ 0 -10px 10px blue, /*顶部阴影*/ 0 10px 10px green; /*底边阴影*/ } /*叠加异色阴影*/ .box-shadow-6{ box-shadow:0 0 10px 5px black, 0 0 10px 20px red; } /*类border边框效果(只设置阴影扩展半径和阴影颜色)*/ .box-shadow-7{ box-shadow: 0 0 0 1px red; } /*兼容ie*/ .box-shadow{ filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696',Direction=135, Strength=5);/*for ie6,7,8*/ background-color: #ccc; -moz-box-shadow:2px 2px 5px #969696;/*firefox*/ -webkit-box-shadow:2px 2px 5px #969696;/*webkit*/ box-shadow:2px 2px 5px #969696;/*opera或ie9*/ } </style></head><body><p class="box-shadow-1"></p><p class="box-shadow-2"></p><p class="box-shadow-3"> </p><p class="box-shadow-4"></p><p class="box-shadow-5"></p><p class="box-shadow-6"></p><p class="box-shadow-7"> </p><p class="box-shadow"></p></body></html>
##
The above is the detailed content of Detailed explanation on the use of box-shadow attribute in CSS3. 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;".

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!

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);}".

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. .
