html - how to show like chat box for the div/p tag top left/right corners -


we developing chat application in application showing text in div want give css chat box direction div(top right/left border) below screen shot.

i marked in red color in screen shot need do

requirement screen shot

.right {    position: relative;    background: white;    text-align: right;    padding: 10px 15px;    border-radius: 6px;    border: 1px solid #ccc;    float: right;    right: 20px;  }    .right::before {    content: '';    position: absolute;    visibility: visible;    top: -1px;    right: -10px;    border: 10px solid transparent;    border-top: 10px solid #ccc;  }    .right::after {    content: '';    position: absolute;    visibility: visible;    top: 0px;    right: -8px;    border: 10px solid transparent;    border-top: 10px solid white;    clear: both;      }    div{    clear: right;  }    .right img {  	display: block;  	height: auto;  	max-width: 100%;  }
<div class="right">    <span>thanks</span>  </div>    <div class="right">    <p style="margin-top: 0px;margin-bottom: 0px;color:green;font-size: 11px;">kranti</p>    <span>thanks</span>     <p style="float: left;margin-bottom: 0px;color:red;font-size: 11px;">2:33 pm</p>  </div>        <div class="right">    <span>thanks</span>  </div>

how give give name ,time , message in chat box. below screen shot want

enter image description here

use pseudoelements ::after , ::before.

.right {   position: relative;   background: aqua;   text-align: right;   min-width: 45%;   padding: 10px 15px;   border-radius: 6px;   border: 1px solid #ccc;   float: right;   right: 20px; }  .right::before {   content: '';   position: absolute;   visibility: visible;   top: -1px;   right: -10px;   border: 10px solid transparent;   border-top: 10px solid #ccc; }  .right::after {   content: '';   position: absolute;   visibility: visible;   top: 0px;   right: -8px;   border: 10px solid transparent;   border-top: 10px solid aqua;   clear: both; } 
<div class="right">   <span>thanks</span> </div> 

for example https://jsfiddle.net/2bekec10/


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -