Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Box-shadow over border

Tags:

html

css

I have this problem where I want to have a border and a box-shadow, but the shadow must be over the border.

The box-shadow property starts when the border ends, is it possible to move it over the border?

.border
{       
    border: solid rgba(128,42,42,.98) 16px;
}


.img-box-shadow
{
    -moz-box-shadow: 0px 0px 20px #000000;
    -webkit-box-shadow: 0px 0px 20px #000000;
    box-shadow: 0px 0px 20px #000000;
}

My HTML:

<img class="border img-box-shadow" src="img.png">

Already tried inset in my box shadow, but it didn't work!

I'm looking for this effect:

border

And I'm getting this result:

shadow in border

like image 463
Mandi Avatar asked Feb 20 '14 04:02

Mandi


People also ask

How do you put a border on a box shadow?

The trick here would be to make use of the 4th (underutilized IMHO) parameter for box-shadow, called spread-radius . This will "spread" (expand) or "choke" (shrink) the box shadow's reference frame by that many pixels before the blur radius is applied.

How do I set the box shadow on the bottom only?

To display the shadow at the bottom of the image, the “box-shadow” property is used. For this purpose, offset-x is set as “0”, offset-y is any positive value, and the color you want to display is also set.

What is inset in box shadow?

A box-shadow is defined as X and Y relative offset values to the element, blur and spread radius, and color. In this article, we will learn how to set the inset shadow using CSS. Inset property changes the outer shadow to the inner shadow.


1 Answers

I think this would be much more easily achieved with two overlayed box shadows

Something like this approaches what you're looking for

box-shadow: 0 0 20px 5px #000000,
    0 0 0 16px rgba(128,42,42,.98);
like image 115
Zach Saucier Avatar answered Sep 25 '22 13:09

Zach Saucier