- This topic is empty.
-
AuthorPosts
-
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 #50779whiteInkDesignMemberif 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 #50763chrisburtonParticipantI just created this in photoshop, are you referring to one of these types of box shadows?
http://i54.tinypic.com/2m6s4r6.png
@whiteinkdesign, you can have multiple shadows in the same element : )
Follow Me @itschrisburtonApril 16, 2011 at 1:43 am #50744whiteInkDesignMember@ChristopherBurton
ok, well then how do you write the CSS for multiple shadows on the same element?April 16, 2011 at 2:01 am #50727chrisburtonParticipant@whiteinkdesign Easier than it seems. The shadows below won’t look pretty if you apply it to any element, fyi. Just an example.
#div {
box-shadow:
1px 1px 1px #888,
inset 1px 1px 1px #222,
2px 3px 2px #111;
}
April 16, 2011 at 2:42 am #50728whiteInkDesignMemberah, alright, that makes sense, multiple values on the same property.
April 16, 2011 at 3:30 am #50729chrisburtonParticipant@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 #50685whiteInkDesignMemberbox-shadow: inset 0 5px 5px #ccc, inset 0 -5px 5px #ccc;
should work pretty well.April 16, 2011 at 10:49 pm #50686chrisburtonParticipant@Thadley isn’t that exactly what the first button shows in the image I created?
April 16, 2011 at 11:09 pm #50688chrisburtonParticipantIt 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. *
box-shadow:
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; -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.