Modelesq
Modelesq

Reputation: 5402

Border around bubble + arrow(triangle) in css

I can't seem to get a border around my arrow. I've been following this source, but I can't seem to get mine to work. So I made a fiddle here to show you what I'm working with.

<div class="share-bubble">0</div>

.share-bubble{
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 0 2px #B2B2B2;
  display: inline-block;
  padding: 6px 10px;
  position: relative;
  vertical-align: top;
  border: 1px solid #CCC;
}
.share-bubble::before {
    background-color: white;
    content: "\00a0";
    display: block;
    height: 8px;
    position: absolute;
    top: 11px;
    left: -5px;
    transform:             rotate( 29deg ) skew( -35deg );
        -moz-transform:    rotate( 29deg ) skew( -35deg );
        -ms-transform:     rotate( 29deg ) skew( -35deg );
        -o-transform:      rotate( 29deg ) skew( -35deg );
        -webkit-transform: rotate( 29deg ) skew( -35deg );
    width:  10px;
}

How do I get a border around my arrow? Thanks for your help in advance.

Upvotes: 0

Views: 1827

Answers (2)

Zoltan Toth
Zoltan Toth

Reputation: 47667

Here you go - DEMO

.share-bubble {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 6px #B2B2B2;
    display: inline-block;
    padding: 10px 18px;
    position: relative;
    vertical-align: top;
    float: left;   
    margin: 5px 45px 5px 20px; 
}

.share-bubble::before {
    background-color: #fff;
    content: "\00a0";
    display: block;
    height: 16px;
    position: absolute;
    top: 11px;
    transform:             rotate( 29deg ) skew( -35deg );
        -moz-transform:    rotate( 29deg ) skew( -35deg );
        -ms-transform:     rotate( 29deg ) skew( -35deg );
        -o-transform:      rotate( 29deg ) skew( -35deg );
        -webkit-transform: rotate( 29deg ) skew( -35deg );
    width:  20px;
    box-shadow: -2px 2px 2px 0 rgba( 178, 178, 178, .4 );
    left: -9px;  
}
   

 <div class="share-bubble">0</div>

You can also see the demo by click on "Run code snippet"..

Upvotes: 3

Hakim
Hakim

Reputation: 3437

You have to add a box-shadow in your .share-bubble::before too.

Upvotes: 0

Related Questions