2

At my website i want to make a speech bubble and found a great tutorial for doing so. But i want to do some changes, but i dont know how to. Basicly i want to flip the little triangle horizontally, so its vertical on the right side instead of the left. Here is the CSS:

.bubble
{
    margin-top: 100px;
    position: relative;
    width: 200px;
    height: 100px;
    text-align: center;
    line-height: 100px;
    background-color: #fff;
    border: 8px solid #666;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
    -webkit-box-shadow: 2px 2px 4px #888;
    -moz-box-shadow: 2px 2px 4px #888;
    box-shadow: 2px 2px 4px #888;
}


.bubble:after
{
    content: ' ';
    position: absolute;
    width: 0;
    height: 0;
    left: 38px;
    top: 100px;
    border: 15px solid;
    border-color: #fff transparent transparent #fff;
}
web-tiki
  • 99,765
  • 32
  • 217
  • 249
McKeene
  • 285
  • 1
  • 6
  • 15

3 Answers3

3

try below css:

.bubble:after {
    -moz-border-bottom-colors: none;
    -moz-border-image: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    border-color: orange orange transparent transparent; // See here i change the color
    border-style: solid;
    border-width: 15px;
    content: " ";
    height: 0;
    position: absolute;
    right: 38px; // see here for position
    top: 100px;
    width: 0;
}

.bubble:before {
    border: 25px solid;
    content: " ";
    height: 0;
    position: absolute;
    right: 30px; // see here for position
    top: 100px;
    width: 0;
}
w3uiguru
  • 5,864
  • 2
  • 21
  • 25
2

Here is a jsFiddle to show it working. Referenced from Pure CSS Bubbles

CSS

.bubble {
    margin-top: 100px;
    position: relative;
    width: 200px;
    height: 100px;
    text-align: center;
    line-height: 100px;
    background-color: orange;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
}

.bubble:after {
    content:"";
    position:absolute;
    bottom:-20px; 
    left:50px; 
    border-width:20px 0 0 20px; 
    border-style:solid;
    border-color: orange transparent;
    display:block; 
    width:0;
}

HTML

    <div class="bubble">
        nice
    </div>
Black Bird
  • 797
  • 1
  • 10
  • 34
0

For now i fixed it by flipping the element. Is there another method that is the correct way to do it?

-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1); 
McKeene
  • 285
  • 1
  • 6
  • 15