search
HomeWeb Front-endCSS TutorialDetailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture)

Basic description:

Outer shadow: box-shadow: X axis Y axis Rpx color;

Attribute description (corresponding order): The X-axis of the shadow (negative values ​​can be used) The Y-axis of the shadow (negative values ​​can be used) Shadow blur value (size) Shadow color

Inner shadow: box-shadow: X axis Y axis Rpx color inset;

Default is outer shadow Inner shadow: inset can be set to inner shadow

Note (PS): This attribute is used for box models such as (p, p, h1, h2, h3, h4, h5, h6, etc.) and is not used to set text shadow. Ifset text shadow, please refer to the knowledge point: text-shadow (Similarly)

Because it is a new attribute, in order to be compatible with major browsers and support lower versions of these major browsers, when using the box-shadow attribute on mainstream browsers, we The name of the attribute needs to be written in the form -webkit-box-shadow. Firefox browser needs to be written in the form of -moz-box-shadow

#In order to better understand the characteristics of box-shadow, do a few small tests: (For the convenience of nesting styles directly within tags)

Test 1:

<p style="box-shadow: 0 0 10px #f00; border:1px solid green">
</p>  box-shadow: 0 0 10px #f00

(Because the X-axis and Y-axis movement settings are not set, the radius range and color will be affected)


Detailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture)

Test 2:

<p style="box-shadow:4px 4px 10px #f00; border:1px solid green">
</p> box-shadow:4px 4px 10px #f00;

Different from Test 1, the X-axis and Y-axis have changed

Positive value (Positive value goes to the right and down) So it becomes like this‍


Test 3:

Detailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture)

<p   style="max-width:90%">
</p> box-shadow:-4px -4px 10px #f00;

##The difference from test 2 is that the X axis and Y The axis changed to negative value (negative value goes left and up) so it becomes like this‍

Detailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture)

#Similarly: You can test the effect of the next positive value and the next negative value, but I won’t do the test here. . . . . . . .

Test 4:

<p  style="box-shadow:-10px 0px 10px red,   /*左边阴影*/ 
0px -10px 10px #000,  /*上边阴影*/ 
10px 0px 10px green,  
/*右边阴影*/ 
0px 10px 10px blue;" 
/*下边阴影*/ 
></p>

##You will feel very messy when you see this code, but after seeing the effect picture, you will understand how it is done. It is just a matter of changing the X-axis and Y-axis positions and color values. Shadow value sizes, (separated by commas) just practice a few times

Detailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture)

测试5:--内阴影  

<p style="box-shadow: 0px 0px 10px red inset; border:1px solid green">
</p> box-shadow: 0px 0px 10px red inset;

  与上面写法相同 唯一不同的是添加了一个inset 其它属性与外阴影相同

Detailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture)

百变不离其宗,练习就能熟悉,懂了就知道原理,随意改写,在配合css3的动画效果, 闪光层(字)都很简单实现。。希望对你有帮助。。

The above is the detailed content of Detailed explanation of examples of box-shadow outer shadow and outer glow in css3 (picture). For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
@keyframes vs CSS Transitions: What is the difference?@keyframes vs CSS Transitions: What is the difference?May 14, 2025 am 12:01 AM

@keyframesandCSSTransitionsdifferincomplexity:@keyframesallowsfordetailedanimationsequences,whileCSSTransitionshandlesimplestatechanges.UseCSSTransitionsforhovereffectslikebuttoncolorchanges,and@keyframesforintricateanimationslikerotatingspinners.

Using Pages CMS for Static Site Content ManagementUsing Pages CMS for Static Site Content ManagementMay 13, 2025 am 09:24 AM

I know, I know: there are a ton of content management system options available, and while I've tested several, none have really been the one, y'know? Weird pricing models, difficult customization, some even end up becoming a whole &

The Ultimate Guide to Linking CSS Files in HTMLThe Ultimate Guide to Linking CSS Files in HTMLMay 13, 2025 am 12:02 AM

Linking CSS files to HTML can be achieved by using elements in part of HTML. 1) Use tags to link local CSS files. 2) Multiple CSS files can be implemented by adding multiple tags. 3) External CSS files use absolute URL links, such as. 4) Ensure the correct use of file paths and CSS file loading order, and optimize performance can use CSS preprocessor to merge files.

CSS Flexbox vs Grid: a comprehensive reviewCSS Flexbox vs Grid: a comprehensive reviewMay 12, 2025 am 12:01 AM

Choosing Flexbox or Grid depends on the layout requirements: 1) Flexbox is suitable for one-dimensional layouts, such as navigation bar; 2) Grid is suitable for two-dimensional layouts, such as magazine layouts. The two can be used in the project to improve the layout effect.

How to Include CSS Files: Methods and Best PracticesHow to Include CSS Files: Methods and Best PracticesMay 11, 2025 am 12:02 AM

The best way to include CSS files is to use tags to introduce external CSS files in the HTML part. 1. Use tags to introduce external CSS files, such as. 2. For small adjustments, inline CSS can be used, but should be used with caution. 3. Large projects can use CSS preprocessors such as Sass or Less to import other CSS files through @import. 4. For performance, CSS files should be merged and CDN should be used, and compressed using tools such as CSSNano.

Flexbox vs Grid: should I learn them both?Flexbox vs Grid: should I learn them both?May 10, 2025 am 12:01 AM

Yes,youshouldlearnbothFlexboxandGrid.1)Flexboxisidealforone-dimensional,flexiblelayoutslikenavigationmenus.2)Gridexcelsintwo-dimensional,complexdesignssuchasmagazinelayouts.3)Combiningbothenhanceslayoutflexibilityandresponsiveness,allowingforstructur

Orbital Mechanics (or How I Optimized a CSS Keyframes Animation)Orbital Mechanics (or How I Optimized a CSS Keyframes Animation)May 09, 2025 am 09:57 AM

What does it look like to refactor your own code? John Rhea picks apart an old CSS animation he wrote and walks through the thought process of optimizing it.

CSS Animations: Is it hard to create them?CSS Animations: Is it hard to create them?May 09, 2025 am 12:03 AM

CSSanimationsarenotinherentlyhardbutrequirepracticeandunderstandingofCSSpropertiesandtimingfunctions.1)Startwithsimpleanimationslikescalingabuttononhoverusingkeyframes.2)Useeasingfunctionslikecubic-bezierfornaturaleffects,suchasabounceanimation.3)For

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools