I'm using border-radius
and box-shadow
to make a glow around an element.
Can I remove only the top part of the box-shadow
?
Live example
div { margin-top: 25px; color: #fff; height: 45px; margin-top: -5px; z-index: -10; padding: 26px 24px 46px; font-weight: normal; background: #000; /*#fff;*/ border-top: 0px solid #e5e5e5; border-left: 1px solid #e5e5e5; border-right: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; -webkit-border-radius: 3px; -khtml-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: rgba(200,200,200,0.7) 0px 0px 10px 0px; -khtml-box-shadow: rgba(200,200,200,0.7) 0px 0px 10px 0px; -moz-box-shadow: rgba(200,200,200,0.7) 0px 0px 10px 0px; box-shadow: rgba(200,200,200,0.7) 0px 0px 10px 0px; }
Edit: this little thingy is the problem!
The simple answer is that you can't. box-shadow applies to the whole element only. You could use a different approach and use ::before in CSS to insert an 1-pixel high element into header nav and set the box-shadow on that instead.
Use the box-shadow Property to Set the Bottom Box Shadow in CSS. We can use the box-shadow property to set the shadow only at the bottom of the box. The box-shadow property sets the shadow of the selected element.
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.
This works, but I'll admit to not knowing if there's a better way (or if it's possible without adding a wrapper element). Using multiple box-shadow
s would be a good idea, but I can't seem to make it look the same.
See: http://jsfiddle.net/thirtydot/8qEUc/3/
HTML:
<div id="bla"> <div> something </div> </div>
CSS:
#bla { overflow-y: hidden; padding: 0 10px 10px 10px; margin: 0 -10px } #bla > div { /* the CSS from your question here */ }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With