Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shadow inside of a div

Tags:

css

shadow

Is it possible to display a shadow inside a div box without using pictures? Instead I want to use css commands.

So is there some command like: -webkit-box-shadow: 1px inset; ?

like image 819
Tim Daubenschütz Avatar asked Mar 12 '12 10:03

Tim Daubenschütz


People also ask

How do you add an inner shadow to a box?

Note: By default, the shadow generates outside the box but by the use of inset we can create the shadow inside the box. Syntax: box-shadow: h-offset v-offset blur spread color | inset; Approach: To give the inset shadow to an element, we will use the box-shadow property.

Which property is used to add shadow to a div?

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.

How do you get rid of shadow on one side?

1) Set your shadow's horizontal alignment to the left (negative values). box-shadow: -30px 0px 10px 10px #888888; Although this way you won't have the same shadow size in the top and bottom. 2) Use a div inside a div and apply shadow to each one.


2 Answers

Yup there is a command inset. like this:

-webkit-box-shadow: 0 0 1px 3px #000 inset;
-moz-box-shadow: 0 0 1px 3px #000 inset;
box-shadow: 0 0 1px 3px #000 inset;

You can generate from here http://css3generator.com/

like image 178
sandeep Avatar answered Sep 26 '22 02:09

sandeep


In CSS3 there's box-shadow which can also be inset to do exactly what you need. This is supported by the following browsers:

  • Chrome >= 10.0 (>= 4.0 with -webkit prefix)
  • Firefox >= 4.0 (>= 3.5 with -moz prefix)
  • IE >= 9.0
  • Opera >= 10.5
  • Safari >= 5.1 (>= 5.0 with -webkit prefix)
like image 39
oezi Avatar answered Sep 25 '22 02:09

oezi