Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Section of a Box Shadow

Tags:

css

Disclaimer: I have already seen the following questions and their solutions did not apply to me even though they are very similar situations:

  • Creating a CSS3 box-shadow on all sides but one
  • How to add drop shadow to the current element in a tab menu?
  • CSS shadows on 3 sides

Simply put, I am trying to add a -moz-box-shadow of 0 0 10px to the .current_page_item class that is applied to the currently active tab in the tab navigation at the top of my website. The website does not yet include the actual box-shadow or any of these changes, I have only been playing with these modifications in firebug for now before I actually publish them. Naturally this causes the shadow to appear on all sides, and so the bottom edge's shadow overlaps into the .content div which stores all of the blog's actual content, i.e. posts.

Based on what I have seen so far, it seems like I should set the z-index of something, not sure what (I have tried ul.menu) to something lower and the z-index of the .content div to something higher, but this seems to have no effect.

I am just wondering if this is normal behavior and if not, if someone could help me out with this situation.

Thanks, I really appreciate it.

EDIT: I put box-shadow in the post earlier, but I meant the respective specific directives, such as -moz-box-shadow. That was not the problem I was having.

like image 945
Jorge Israel Peña Avatar asked Jan 07 '10 00:01

Jorge Israel Peña


People also ask

How do you hide a shadow in a box?

The box-shadow styles are used to pay attention to the content. Primer CSS Box Shadow Remove style is mainly used to remove the box-shadow. To remove the box-shadow, we will add an additional class . box-shadow-none.

How do you get rid of shadow on one side?

Use a width calc() to position two elements next to each other. Then add the box-shadow to both elements, followed by the clip-path on only one of them. Set the z-index of the clip-path'd element to be higher than the non-clip-path'd element. Here's an example.

What is blur radius in box shadow?

<blur-radius> This is a third <length> value. The larger this value, the bigger the blur, so the shadow becomes bigger and lighter. Negative values are not allowed. If not specified, it will be 0 (the shadow's edge is sharp).

How do you add a shadow to only one side?

To set a box-shadow on one side of the element, use the box-shadow property. This property has four length parameters and a color. box-shadow: h-offset v-offset blur spread color; h-offset sets the shadow horizontally.


2 Answers

You will need to add overflow:hidden on the ul.menu as honeybuzzer mentions, but since that would also cut-off the top shadow you should add some padding-top to the ul.menu as well..

like image 55
Gabriele Petrioli Avatar answered Nov 15 '22 09:11

Gabriele Petrioli


overflow:hidden on ul.menu seems to get rid of the bottom shadow.

like image 24
honeybuzzer Avatar answered Nov 15 '22 10:11

honeybuzzer