CSS3 Box Shadow on Top, Left, and Right Only

前端 未结 10 1706
终归单人心
终归单人心 2020-12-15 03:24

Greetings,

I am trying to apply a CSS3 box shadow to only the top, right, and left of a DIV with a radius that matches the result of the following CSS (minus the bot

10条回答
  •  温柔的废话
    2020-12-15 03:58

    I was having the same issue and was searching for a possible idea to solve this.

    I had some CSS already in place for my tabs and this is what worked for me:

    (Note specifically the padding-bottom: 2px; inside #tabs #selected a {. That hides the bottom box-shadow neatly and worked great for me with the following CSS.)

    #tabs {
        margin-top: 1em;
        margin-left: 0.5em;
    }
    #tabs li a {
        padding: 1 1em;
        position: relative;
        top: 1px;
        background: #FFFFFF;
    }
    #tabs #selected {
        /* For the "selected" tab */
        box-shadow: 0 0 3px #666666;
        background: #FFFFFF;
    }
    #tabs #selected a {
        position: relative;
        top: 1px;
        background: #FFFFFF;
        padding-bottom: 2px;
    }
    #tabs ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    #tabs li {
        float: left;
        border: 1px solid;
        border-bottom-width: 0;
        margin: 0 0.5em 0 0;
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
    }
    

    Thought I'd put this out there as another possible solution for anyone perusing SO for this.

提交回复
热议问题