Box with a triangle like a chat
Here's the same output with :after
property :
HTML
<p>
Hello!!!
</p>
CSS
p {
display:inline-block;
padding:5px 6px 8px 6px;
border-radius: 6px;
float: right;
margin-right: 40px;
color:black;
background-color:#146f79;
position: relative;
}
p:after {
content: "";
position:absolute;
margin-top:-6px;
margin-left:-5px;
border-left: 12px solid transparent;
border-right: 12px solid transparent;
border-bottom: 12px solid #146f79;
transform:rotate(-45deg);
right: -15px;
top: 10px;
}
Fiddle
i think this site help you : https://css-tricks.com/examples/ShapesOfCSS/
#talkbubble { width: 120px; height: 80px; background: red; position: relative; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; }
#talkbubble:before { content:""; position: absolute; left: 100%; top: 26px; width: 0; height: 0; border-top: 13px solid transparent; border-left: 26px solid red; border-bottom: 13px solid transparent; }
<div id="talkbubble"></div>
Kadriles is right, but I already made simple example without any negative margin or box sizes
.bubble {
position: absolute;
background: slategray;
color: white;
padding: 6px 10px;
border-radius: 5px 0 5px 5px;
}
.bubble:after {
content: '';
position: absolute;
left: 100%;
top: 0;
border-top: 8px solid slategray;
border-right: 12px solid transparent;
}
<div class="bubble">Hello</div>