Speech bubble with arrow

前端 未结 3 1028
名媛妹妹
名媛妹妹 2020-11-22 02:08

I have a project where I need to insert speech bubbles / message boxes. The general shape I am trying to achieve is this one :

3条回答
  •  半阙折子戏
    2020-11-22 02:29

    SVG

    This does not pass a hit-test as the transparent border is also clickable

    This can be done using the pointer-events in svg.
    pointer-events:visibleFill; Will only select the part where there is paint.

    This example uses filter_box-shadow and is not supported by IE.
    Also uses two shapes.

    html,
    body {
      margin: 0;
      padding: 0;
    }
    .bubble {
      width: 150px;
      height: 150px;
      -webkit-filter: drop-shadow(5px 5px 0px #aaa);
      filter: drop-shadow(5px 5px 0px #aaa);
    }
    .bubble-shape {
      fill: #1e1;
    }
    .shape-text {
      color: black;
    }
    
      
        
        
      
    

    enter image description here

    This example uses one path
    Should be fully supported by IE.

    html,
    body {
      margin: 0;
      padding: 0;
    }
    .bubble {
      width: 150px;
      height: 150px;
    }
    .bubble-shape {
      stroke-width: 15;
      stroke: #ffffd;
      fill: #1e1;
    }
    .shape-text {
      color: black;
    }
    
      
        
      
    

    enter image description here

提交回复
热议问题