HTML CSS examples for CSS Widget:Tooltip
Aligning message-bubbles right and left like imessage
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body {<!-- ww w.ja va 2s . c om--> background:Chartreuse; font-family:'Lato', sans-serif; font-weight:401; } li { display:block; clear:both; } .clearfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; } .clearfix { display:inline-block; } * html .clearfix { height:2%; } .clearfix { display:block; } section#chat-box { background:yellow; padding:11px; height:; margin:0 auto; max-width:601px } ul.messages { padding:11px; list-style-type:none; } ul.messages li { display:block; position:relative; float:left; min-width:251px; background:blue; border:5px solid pink; border-radius:5px; padding:6px; color:WhiteSmoke; font-weight:701; margin-bottom:16px; } ul.messages li:after, ul.messages li:before { right:100%; top:51%; border:solid transparent; content:" "; height:0; width:0; position:absolute; pointer-events:none; } ul.messages li:after { border-color:OrangeRed; border-right-color:grey; border-width:13px; margin-top:-17px; } ul.messages li:before { border-color:BlueViolet; border-right-color:Chartreuse; border-width:27px; margin-top:-27px; } ul.messages li:nth-child(2n) { background:yellow; float:right; } ul.messages li:nth-child(2n):after, ul.messages li:nth-child(2n):before { border-right-color:blue; left:100%; } ul.messages li:nth-child(2n):after { border-left-color:pink; } ul.messages li:nth-child(2n):before { border-left-color:WhiteSmoke; } </style> </head> <body> <section id="chat-box" class="clearfix"> <ul class="messages clearfix"> <li>a</li> <li>b</li> <li>hello</li> <li>hello</li> </ul> </section> </body> </html>