CSS Speech Bubble with Box Shadow

后端 未结 5 1208
青春惊慌失措
青春惊慌失措 2020-11-28 01:48

Creating a DIV that uses CSS to draw a triangle to the left. Trying to apply a uniform box-shadow to both parent and the pseudo element (see images) and code.

Is th

5条回答
  •  情书的邮戳
    2020-11-28 02:43

    I know It's a little bit tricky but, seems nice to me. Here is the fiddle http://jsfiddle.net/dzfj6/

    HTML

    some content

    CSS

    .bubble
    {
        height: 200px;
        width:  275px;
        float:right;
        margin-top: 41px;
        margin-left:11px;
        background-color: #f2f2f2;
        -webkit-border-radius: 5px;
        -webkit-box-shadow: 0px 0px 5px #b2b2b2;
        position:relative;
        z-index:1;
    }
    
    .triangle
    {
       position:absolute;
       top:12px;
       width: 0;
       height: 0;
       border-top: 15px solid transparent;
       border-bottom: 15px solid transparent;
       border-right: 10px solid #f2f2f2;
       margin-left:-9px;
       z-index:3;
    }
    .border
    {        
       position:absolute;
       top:12px;
       width: 0;
       height: 0;
       border-top: 15px solid transparent;
       border-bottom: 15px solid transparent;
       border-right: 10px solid #e0e0e0;
       margin-left:-10px;
       z-index:2;
    }
    
    .content{
       padding:10px;
    }
    

    Instead of box-shadow, you can simply use border for buble.

提交回复
热议问题