I am having the following css code.
box-shadow: 5px 0 0 0px #ccc, 0px 5px 0 0px #ccc, 5px 5px 0 0px #ccc, 0px 10px 0 0px #ccc, 5px 10px 0 0px #ccc, 0px 15px 0 0px #ccc, 5px 15px 0 0px #ccc;
-webkit-box-shadow: 5px 0 0 0px #ccc, 0px 5px 0 0px #ccc, 5px 5px 0 0px #ccc, 0px 10px 0 0px #ccc, 5px 10px 0 0px #ccc, 0px 15px 0 0px #ccc, 5px 15px 0 0px #ccc;
-moz-box-shadow: 5px 0 0 0px #ccc, 0px 5px 0 0px #ccc, 5px 5px 0 0px #ccc, 0px 10px 0 0px #ccc, 5px 10px 0 0px #ccc, 0px 15px 0 0px #ccc, 5px 15px 0 0px #ccc;
Is it possible to create mixin for this ?
you can Create mixins via the #mixin rule. The #mixin keyword must be followed by the mixin name and a declaration block.
The following lines define a mixin, and give it three property-value pairs:
#mixin .shadow{
box-shadow: 5px 0 0 0px #ccc, 0px 5px 0 0px #ccc, 5px 5px 0 0px #ccc, 0px 10px 0 0px #ccc, 5px 10px 0 0px #ccc, 0px 15px 0 0px #ccc, 5px 15px 0 0px #ccc;
-webkit-box-shadow: 5px 0 0 0px #ccc, 0px 5px 0 0px #ccc, 5px 5px 0 0px #ccc, 0px 10px 0 0px #ccc, 5px 10px 0 0px #ccc, 0px 15px 0 0px #ccc, 5px 15px 0 0px #ccc;
-moz-box-shadow: 5px 0 0 0px #ccc, 0px 5px 0 0px #ccc, 5px 5px 0 0px #ccc, 0px 10px 0 0px #ccc, 5px 10px 0 0px #ccc, 0px 15px 0 0px #ccc, 5px 15px 0 0px #ccc;
}
Related
I was fiddling around with CSS box shadow property. It seems like I can't have the top border shadow when I keep the angle at 90 degrees and apply some distance from bottom. Is there any way I can have top shadow along with bottom shadow.
Here is the FIDDLE
<div class = "someclass">
</div>
.someclass {
-webkit-box-shadow: 0 8px 11px -5px #000;
-moz-box-shadow: 0 8px 11px -5px #000;
box-shadow: 0 8px 11px -5px #000;
margin: 20px;
background: pink;
width:300px;
height:300px
}
box-shadow allows multiple, comma-separated values. You can achieve the effect you want like so:
.someclass {
box-shadow: 0 8px 11px -5px #000,
0 -8px 11px -5px #000;
}
Make sure to also add it to the appropriate prefixed declarations:
.someclass {
-webkit-box-shadow: 0 8px 11px -5px #000,
0 -8px 11px -5px #000;
-moz-box-shadow: 0 8px 11px -5px #000,
0 -8px 11px -5px #000;
box-shadow: 0 8px 11px -5px #000,
0 -8px 11px -5px #000;
}
i am using the following code to make a shadow inside a div tag..
box-shadow: inset 0 10px 10px -10px #000 , inset 0 -10px 10px -10px #000;
but i get shadows on the top and bottom.. i only want the shadow to appear on top not the botton something like the following picture..
i'e been tinkering with the codes for hours but nothing... how can i do this. thanks.
Like this?
box-shadow: inset 0 10px 20px -15px #000;
DEMO
You need to delete the part after the comma.
box-shadow: inset 0 10px 10px -10px #000;
http://jsfiddle.net/9LzV4/
-webkit-box-shadow:inset 0 3px 5px 0 #E3E3E3;
box-shadow:inset 0 3px 5px 0 #E3E3E3;
for more experiments go to css3 generator
-webkit-box-shadow: inset 0px 6px 16px 0px rgba(0,0,0,0.75);
-moz-box-shadow: inset 0px 6px 5px 0px rgba(0,0,0,0.75);
box-shadow: inset 0px 6px 5px 0px rgba(0,0,0,0.75);
Demo
at the rounded corner, it has crisp edge, is this normal?
-moz-box-shadow: inset 0 0 0px 2px #FFF;
-webkit-box-shadow: inset 0 0 0px 2px #FFF;
box-shadow: inset 0 0 0px 2px #FFF;
I tried border method, doesn't seem to be improved..
I need to create this shadow effect for a client but can't figure out how it could be done:
Is this even possible with pure CSS?
EDIT: Here is my current CSS:
box-shadow: 0 0px 0px #fff,
0 -1px 15px #ccc,
0 0px 0px #fff,
0 0px 0px #fff;
-webkit-box-shadow: 0 0px 0px #fff,
0 -1px 15px #ccc,
0 0px 0px #fff,
0 0px 0px #fff;
-moz-box-shadow: 0 0px 0px #fff,
0 -1px 15px #ccc,
0 0px 0px #fff,
0 0px 0px #fff;
this other answer that I stole from Another Stack OverFlow Question
use the spread value...
box-shadow has the following values
box-shadow: x y blur spread color;
so you could use something like..
box-shadow: 0px -10px 10px -10px black;
here is another answer from the same Question
You can give multiple values to box-shadow property
eg
-moz-box-shadow: 0px 10px 12px 0px #000,
0px -10px 12px 0px #000;
-webkit-box-shadow: 0px 10px 12px 0px #000,
0px -10px 12px 0px #000;
box-shadow: 0px 10px 12px 0px #000,
0px -10px 12px 0px #000;
it is drop shadow to left and right only, you can adapt it to your requirements
EDIT
I was looking that the OP's Post and I think that if you tried this,
box-shadow: 0 0px 0px #fff,
0 -1px 15px #ccc,
0 0px 0px #fff,
0 -1px 15px #ccc;
I think that it should show the way that you are thinking it should.
I assume that the values go in Clockwise Order like Borders or margins or whatever,
Attribute: top, right, bottom, left;
and that you should be able to add a value to the left as you would with the right.
you might have to play around with it a little bit though.
hi trying to get a drop shadow on all sides but the top, for a drop down sub menu
found this code on this site and it has shadow on all sides but not bottom
body {
width: 300px;
height: 200px;
margin: 20px auto;
-webkit-box-shadow: 0 -3px 3px -3px #999, 3px 0px 3px -3px #999, -3px 0px 3px -3px #999;
-moz-box-shadow: 0 -3px 3px -3px #999, 3px 0px 3px -3px #999, -3px 0px 3px -3px #999;
box-shadow: 0 -3px 3px -3px #999, 3px 0px 3px -3px #999, -3px 0px 3px -3px #999
}
how do i change to be shadow on all sides but top?
been trying on fiddle but for the life of me cant understand the above code to change it from top to bottom shadow
http://jsfiddle.net/PuKDb/
need it to be like this one
http://jsfiddle.net/leaverou/8tgAp/
but instead of red line the shadow from above...
im a cut and paste coder so any help would be appreicated!
body {
width: 300px;
height: 200px;
margin: 20px auto;
-webkit-box-shadow: 3px 3px 3px -3px #999, 3px 3px 3px -3px #999, -3px 3px 3px -3px #999;
-moz-box-shadow: 3px 3px 3px -3px #999, 3px 3px 3px -3px #999, -3px 3px 3px -3px #999;
box-shadow: 3px 3px 3px -3px #999, 3px 3px 3px -3px #999, -3px 3px 3px -3px #999
}
no explanation because you obviously have no interest in why it works, just that it does ;)
Probably the author will never access this topic again, but I found out the right definition is made by two declarations, instead of 3:
box-shadow: 3px 5px 8px -1px rgba( 15, 15, 15, .8 ), -3px 5px 8px -1px rgba( 15, 15, 15, .8 );
It's hard to explain, but if you define two primary colors you will see the reason in bottom shadow:
box-shadow: 3px 3px 8px -1px red, -3px 3px 8px -1px yellow;
The presence of a non-zero integer as first value mixes the two colors, producing a new one.
The point is, defining three declarations, one of them will overlay one of the others (depending the arguments) and thus produce darker shadows.
The same is valid for vertical offset. If both them are the same (here represented by 5px), another overlay will happen, in the bottom shadow, if positive, or in the top shadow, if negative (which is not the case of the topic).
I hope it helps somebody else.
This should work for you
body
{
width: 300px;
height: 200px;
margin: 20px auto;
-webkit-box-shadow: 3px 3px 3px -3px #999, 3px 3px 3px -3px #999, -3px 3px 3px -3px #999;
-moz-box-shadow: 3px 3px 3px -3px #999, 3px 3px 3px -3px #999, -3px 3px 3px -3px #999;
box-shadow: 3px 3px 3px -3px #999, 3px 3px 3px -3px #999, -3px 3px 3px -3px #999
}
.div {
-webkit-box-shadow: 0 3px 3px -3px #c00;
-moz-box-shadow: 0 3px 3px -3px #c00;
box-shadow: 0 3px 3px -3px #c00;
}
change the 2nd set of numbers according to the size and blur.