Search results
The horizontal offset of the shadow. A positive value puts the shadow on the right side of the box, a negative value puts the shadow on the left side of the box. Demo . v-offset. Required. The vertical offset of the shadow. A positive value puts the shadow below the box, a negative value puts the shadow above the box. Demo .
- Box Shadow
W3Schools offers free online tutorials, references and...
- Box Shadow
- Overview
- Try it
- Syntax
- Examples
- Browser compatibility
- See also
The box-shadow CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the element, blur and spread radius, and color.
The box-shadow property enables you to cast a drop shadow from the frame of almost any element. If a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top).
Box-shadow generator is an interactive tool allowing you to generate a box-shadow.
Specify a single box-shadow using:
•Two, three, or four values.
•If only two values are given, they are interpreted as and values.
•If a third value is given, it is interpreted as a .
•If a fourth value is given, it is interpreted as a .
•Optionally, the inset keyword.
Setting three shadows
In this example, we include three shadows: an inset shadow, a regular drop shadow, and a 2px shadow that creates a border effect (we could have used an outline instead for that third shadow).
Setting zero for offset and blur
When the x-offset, y-offset, and blur are all zero, the box shadow will be a solid-colored outline of equal-size on all sides. The shadows are drawn back to front, so the first shadow sits on top of subsequent shadows. When the border-radius is set to 0, as is the default, the corners of the shadow will be, well, corners. Had we put in a border-radius of any other value, the corners would have been rounded. We added a margin the size of the widest box-shadow to ensure the shadow doesn't overlap adjacent elements or go beyond the border of the containing box. A box-shadow does not impact box model dimensions.
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
•The data type (for specifying the shadow color)
•text-shadow
•drop-shadow()
•Applying color to HTML elements using CSS
- no
- none
Sep 22, 2022 · The vertical offset (required) of the shadow, a negative one means the box-shadow will be above the box, a positive one means the shadow will be below the box. The blur radius (required), if set to 0 the shadow will be sharp, the higher the number, the more blurred it will be, and the further out the shadow will extend.
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
Sep 21, 2009 · CSS Box Shadow. Used in casting shadows off block-level elements (like divs). box-shadow: 3px 3px 5px 6px #ccc; The horizontal offset of the shadow, positive means the shadow will be on the right of the box, a negative offset will put the shadow on the left of the box. The vertical offset of the shadow, a negative one means the box-shadow will ...
Feb 28, 2024 · In the box shadow example below, we have an x-offset of 0px, y-offset of 9px and blur radius of 30px. The color of the box shadow has an alpha value of 0.1. Unlike the previous box shadow examples, the example below has a single box shadow. .box{width:200px;height:50px;box-shadow:0px9px30pxrgba(229,178,107,0.1);}
People also ask
How do you offset a box shadow in CSS?
What is a box shadow in CSS?
What is the offset of a shadow in AutoCAD?
How do you cast shadows off a block-level element?
What does the vertical offset of a shadow mean?
What is a box shadow in AutoCAD?
Jun 30, 2021 · How to Combine Both offset-x and offset-y. Write the following code in your CSS: 👇. .box-1{ box-shadow: 10px 10px rgba(0,0,0,0.5); } Here's the result with the box shadow showing on the right and bottom of the button: 👇. Our button with box shadow.