- This topic is empty.
April 15, 2011 at 4:12 pm #32373ThadleyParticipant
Hey everyone, I was having little confusion with the CSS box shadow property. I want to have inner shadow on a box but only on the top and bottom sides, not the left and the right.
This is what i have right now.
box-shadow: inset 5px 5px 5px #ccc;
Problem that I’m having is that it always does it on top or border with left or right, never just top and bottom.
If anyone knows, think you could help! Thanks!April 15, 2011 at 5:05 pm #50779
if i remember how it works correctly the first number controls left-to-right shadow. The second number controls top&bottom shadow. The third controls the feathering of the shadow. Therefore you can’t have both top and bottom shadows on the same element.
It sounds like you want to use a linear gradient instead.
http://css3please.com/April 15, 2011 at 11:54 pm #50763April 16, 2011 at 1:43 am #50744
ok, well then how do you write the CSS for multiple shadows on the same element?April 16, 2011 at 2:01 am #50727
@whiteinkdesign Easier than it seems. The shadows below won’t look pretty if you apply it to any element, fyi. Just an example.
1px 1px 1px #888,
inset 1px 1px 1px #222,
2px 3px 2px #111;
April 16, 2011 at 2:42 am #50728
ah, alright, that makes sense, multiple values on the same property.April 16, 2011 at 3:30 am #50729
@whiteinkdesign incase you didn’t know, the same thing applies for text-shadow. You can use multiples as well.April 16, 2011 at 9:35 pm #50684ThadleyParticipant
@christopherburton no not really, basically you have your box shadow on all sides on the inside, although I only want top and bottom because the left and right will make it look dumb.
Unless, is there a way i can push the left and right sides of the box off the screen at any resolution so that the shadow is there although you can’t see it?April 16, 2011 at 10:28 pm #50685
box-shadow: inset 0 5px 5px #ccc, inset 0 -5px 5px #ccc;
should work pretty well.April 16, 2011 at 10:49 pm #50686
@Thadley isn’t that exactly what the first button shows in the image I created?April 16, 2011 at 11:09 pm #50688
It would be more helpful in the future if you displayed the button or whatever you’re using this for so I can test off of it.
* Change the last box-shadow to the background color of the button. *
inset 0 1px 1px rgba(0, 0, 0, .5),
inset 0 -1px 1px rgba(0, 0, 0, .5),
inset -1px 0 -1px #color-of-background-here;
- The forum ‘CSS’ is closed to new topics and replies.