CSS3 Question: how to have no box shadow on the top of a div?

前端 未结 2 1175
盖世英雄少女心
盖世英雄少女心 2021-02-11 17:39

Right now when I do this:

-moz-box-shadow: 0 0 200px #00C0FF;
-webkit-box-shadow: 0 0 200px #00C0FF;
box-shadow: 0 0 200px #00C0FF;

it gives a

2条回答
  •  走了就别回头了
    2021-02-11 18:20

    If you can nest two divs then you should be able to use a combination of margins and overflow:hidden to 'chop off' the top shadow without losing the required effect on the other edges.

    For example this mark-up:

    hello

    And this CSS

    .outer {
        margin-top: 200px;
        overflow: hidden;   
    }
    
    .inner {
        width:200px;
        height: 200px;
        margin: 0 200px 200px 200px;
        -moz-box-shadow: 0px 5px 200px #00C0FF;
        -webkit-box-shadow: 0px 5px 200px #00C0FF;
        box-shadow: 0px 5px 200px #00C0FF;
    }
    

    Gives this result - http://jsfiddle.net/ajcw/SLTE7/2/

提交回复
热议问题