Drop shadow issue - css

Following is my jsfiddle in which i am trying to drop shadow on table.
The problem is shadow is droping on bottom and right of the table but not on left and top side of the table kindly let me know how can i modify the css of my fiddle so shadow will be droped on all sides of the table. Thanks,
http://jsfiddle.net/7RQtq/
.shadow {
-moz-box-shadow: 3px 3px 4px #000;
-webkit-box-shadow: 3px 3px 4px #000;
box-shadow: 3px 3px 4px #000;
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');
}

Reset the x, y co-ordinates:
-moz-box-shadow: 0px 0px 4px #000;
-webkit-box-shadow: 0px 0px 4px #000;
box-shadow: 0px 0px 4px #000;
border-radius: 5px;
Explanation
The first option is x co-ordinate, the second is y. So, resetting both to 0px will give you centered. And, increasing the spread, the third value, will give you like Photoshop. Also, giving some border-radius will show exactly how you want.
Screenshot
Fiddle: http://jsfiddle.net/7RQtq/4/

First two parameters are x (right) and y (bottom) traslation... set them to 0px for a centered shadow:
http://jsfiddle.net/7RQtq/1/
-moz-box-shadow: 0px 0px 4px #000;
-webkit-box-shadow: 0px 0px 4px #000;

Don't know about the legacy IE filters, but for other browsers you can use box-shadow: 0 0 16px #000;. The first two values indicate offset, and the third indicates blur of the shadow.
Demo: http://jsfiddle.net/7RQtq/3/
Generator Tool: http://www.webtutorialplus.com/box-shadow.aspx
Spec: http://www.w3.org/TR/css3-background/#box-shadow
The ‘box-shadow’ property attaches one or more drop-shadows to the
box. The property is a comma-separated list of shadows, each specified
by 2-4 length values, an optional color, and an optional ‘inset’
keyword. Omitted lengths are 0; omitted colors are a UA-chosen color.
Where = inset? && [ {2,4} && ? ]
The components of each are interpreted as follows:
The first length is the horizontal offset of the shadow. A positive value draws a shadow that is offset to the right of the box, a
negative length to the left.
The second length is the vertical offset. A positive value offsets the shadow down, a negative one up.
The third length is a blur radius. Negative values are not allowed. If the blur value is zero, the shadow's edge is sharp. Otherwise, the
larger the value, the more the shadow's edge is blurred. See below.
The fourth length is a spread distance. Positive values cause the shadow shape to expand in all directions by the specified radius.
Negative values cause the shadow shape to contract. See below. Note
that for inner shadows, expanding the shadow (creating more shadow
area) means contracting the shadow's perimeter shape.
The color is the color of the shadow. If the color is absent, the used
color is taken from the ‘color’ property.
As you might imagine, you can create complicated (and elaborate) effects with a combination of these values, such as:
http://studentwebhosting.com/tutorials/amazing-css3-box-shadow-examples/
http://viget.com/inspire/39-ridiculous-things-to-do-with-css3-box-shadows

Related

Box Shadow - Shadow Offset and Blur Gradient

I'm trying to work out how to achieve the box-shadow effect in the image linked to below. Basically I want no shadow at the top of the box, graduating to a shadow at the bottom.
http://i.imgur.com/JeIhmpd.png
This might help you.
box-shadow: 0px 3px 10px 1px rgba(184,184,184,1);
box-shadow: (horizontal) (vertical) (blur radius) (spread radius) (color)

How to get box-shadow to appear on ngGrid rows?

In this Plunker you can see I've tried to make an inset drop-shadow appear in the viewport area of the grid. It is visible in the space where there are no rows, but none where the rows are. I don't quite understand what about the rows is blocking it.
Below are my styles:
.gridStyle .ngViewport
{
box-shadow:inset 0 0 4px 1px rgba(0,0,0,.3);
}
.gridStyle .ngFooterPanel, .gridStyle .ngTopPanel
{
box-shadow:0 0 3px 1px rgba(0,0,0,.3);
}
Is there a way to get the box-shadow to be visible even when rows are present in the viewport?
You don't see the box-shadow because the the row elements are on TOP of the ngViewport element that has the shadow. If you make the ngViewport container wider than the rows, you'll see the shadow appear at the edges.
You could set a cellClass to define inset box-shadows for the appropriate side(s) of the cells (see Can CSS3 box-shadow:inset do only one or two sides? like border-top?)

Convert from drop shadow of PSD to box shadow of CSS3

I read this article http://heygrady.com/blog/2011/08/06/recreating-photoshop-drop-shadows-in-css3-and-compass/ many times. But I can't find the correct way to convert drop shadow of PSD to box shadow of CSS3 in this case:
Stroke: #E4E4E4; opacity 75%
Inner glow: #FFFFFF 50%; opacity 75%
Drop shadow: Angle=90 degrees; distance=1px; spread=5%; size=9px
border: 1px solid rgba(228,228,228,0.75);
box-shadow: inset 0 0 0 9px rgba(255,255,255,0.75), 0 1px 9px 0 rgba(0,0,0,.5);
I had to guess here a bit as there’s missing information. The rgba(r,g,b,a) colour syntax takes a value of 0–255 for each of the colour components and a 0–1 value for the opacity of the colour. So the border rule is equivalent to Photoshop stroke.
There’s no direct equivalent of an inner glow but you can do an inset box shadow which can simulate it. You specify multiple shadows with a comma on the same rule, so the first one can be the inset shadow. This is specified with an inset keyword to start with, then the x and y offset (none in this case), then a blur radius, then a spread distance, then finally the colour of the shadow. Play with the values; I guessed at 9px for the spread and 0 for the rest.
Finally, we specify a box shadow for the outside. The same rules apply as to the inset shadow (again with my guessing to the values). Have a play around!
There is a cloud based Photoshop extension that you can download and install in photo shop here: http://css3ps.com/. Then select a layer or layers which contain the drop shadow and click a button in toolbox then it will give you the css3 you need that matches the box shadow in the PSD. They have done the calculations for you.
I use it all the time for this question its great.

How can I get box-shadow only on certain sides?

What values need to be defined for a box-shadow that only appears at the bottom.
.element{box-shadow:0 -5px 10px #000}
first value is the position of the shadow on the X,
second is the position of the shadow on the Y,
third is the shadow dimension,
fourth the color.
By putting a negative position Y of half of the shadow dimension, you get no shadow at the bottom of your element.
You could put your box in another one, smaller, with height and width defined, have the overflow hidden, and with a relative position, you hide the shadow you don't want.
This has been asked millions of times. Just use the spread parameter to make it smaller, then move it so that it appears on one side only. Similar question here: drop shadow only bottom css3
I still haven't found a decent looking way that would work in all situations. Here are two methods:
1.) http://jsfiddle.net/pGGXH/28/ - use padding+overflow to show the shadow.
<div class="no-overflow">
<div class="box">my box</div>
</div>
.no-overflow {
overflow:hidden;
padding:5px 5px 0 5px;
}
.box {
border:1px solid #000;
border-radius:5px;
box-shadow:0 0 5px #333;
padding:10px;
}
2.) http://jsfiddle.net/pGGXH/33/ - uses stacking border-shadows (you can get multiple border shadows stacked one on top of the other)
<div class="box">my box</div>
.box {
border:1px solid #000;
border-radius:5px;
box-shadow:0 10px 0 #fff, 0 0 5px #333;
padding:10px;
}
However with border-radius both solutions don't turn out that well.
It appears it's not possible ( http://www.w3.org/TR/css3-background/#the-box-shadow ), you have to try some length values.
The box-shadow property allows web designers to easily implement multiple drop shadows (outer or inner) on box elements, specifying values for color, size, blur and offset.
The property syntax is as follows:
box-shadow: none | <shadow> [ , <shadow> ]*
<shadow> = inset? && [ <length>{2,4} && <color>? ]
For example;
box-shadow: 3px -3px 3px #000000; //Shadow towards North East direction.
Check and experiment here... http://jsfiddle.net/jgsdS/

Soft Edges using CSS?

I am using RGBA to create a transparent background that overlays on top of an image. Works just fine. My questions is this: Is there a way to "soften" the edges of the box to where it flows more into the picture vs a hard edge.
Here is my CSS for the box:
#past{
position:absolute;
left:0;
top:363px;
background-color: rgba(34,34,34,0.6);
/* For IE 5.5 - 7*/
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99222222, endColorstr=#99222222);
/* For IE 8*/
-ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99222222, endColorstr=#99222222);
z-index:10;
padding:10px;
}
I know I can do this by creating a background image in Photoshop but I was looking for a CSS only way vs using an image.
Also I would prefer if at all possible for this to work in all browsers.
Thanks for the help. =>
Another option is to use one of my personal favorite CSS tools: box-shadow.
A box shadow is really a drop-shadow on the node. It looks like this:
-moz-box-shadow: 1px 2px 3px rgba(0,0,0,.5);
-webkit-box-shadow: 1px 2px 3px rgba(0,0,0,.5);
box-shadow: 1px 2px 3px rgba(0,0,0,.5);
The arguments are:
1px: Horizontal offset of the effect. Positive numbers shift it right, negative left.
2px: Vertical offset of the effect. Positive numbers shift it down, negative up.
3px: The blur effect. 0 means no blur.
color: The color of the shadow.
So, you could leave your current design, and add a box-shadow like:
box-shadow: 0px -2px 2px rgba(34,34,34,0.6);
This should give you a 'blurry' top-edge.
This website will help with more information: http://css-tricks.com/snippets/css/css-box-shadow/
It depends on what type of fading you are looking for.
But with shadow and rounded corners you can get a nice result. Rounded corners because the bigger the shadow, the weirder it will look in the edges unless you balance it out with rounded corners.
http://jsfiddle.net/tLu7u/
also.. http://css3pie.com/
You can use CSS gradient - although there are not consistent across browsers so You would have to code it for every one
Like that: CSS3 Transparency + Gradient
Gradient should be more transparent on top or on top right corner (depending on capabilities)

Resources