JSFiddle - React, Tailwind, and code Playground
by SwampFall
HTML
<div class="wrapper">
<div class="msg_wrapper">
<div class="picspace">
<img class="pic" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS_a9uZ0176l3sGtE9pS_v_e9FQd8IgpVsh61q1-P8hUSHPaMMd"/>
</div>
<div class="msg">
<div class="chat_txt other">
<span class="time to">01/01<br>13:52</span><img src="https://cdn.pixabay.com/photo/2017/02/07/16/47/kingfisher-2046453_1280.jpg"/>
</div>
<div class="chat_txt other">
<span class="time to">13:52</span>a
</div>
</div>
</div>
<div class="msg">
<div class="chat_txt you">
en ga da ier ook?<span class="time ty">13:52</span>
</div>
<div class="chat_txt you">
en ga da ier ook?<span class="time ty">13:52</span>
</div>
</div>
</div>
CSS
.wrapper {
width: 100%;
background: red;
}
div {
box-sizing: border-box;
display: block;
}
.other {
background: yellow;
padding-left: 5px;
padding-right: 10px;
float: left;
margin-right: 40%;
margin-bottom: 2px;
}
.you {
float: right;
background: lime;
text-align: right;
padding-left: 10px;
padding-right: 5px;
margin-left: 40%;
margin-bottom: 2px;
}
.msg_wrapper {
min-height: 30px;
}
.msg {
margin: 1px;
}
.chat_txt {
display: block;
padding-top: 5px;
padding-bottom: 5px;
border-radius: 2px 10px 10px 2px;
}
.time {
position: relative;
font-size: 8px;
bottom: -5px;
}
.ty {
margin-left: 5px;
}
.to {
margin-right: 5px;
}
.other:first-child {
border-radius: 10px 10px 10px 2px;
}
.other:last-child {
border-radius: 2px 10px 10px 10px;
}
.other:only-child {
border-radius: 10px;
}
.you:first-child {
border-radius: 10px 10px 2px 10px;
}
.you:last-child {
border-radius: 10px 2px 10px 10px;
}
.you:only-child {
border-radius: 10px;
}
.picspace .pic {
width: 40px;
height: 40px;
}
.picspace {
width: 40px;
display: inline-block;
}
.msg {
width: 90%;
display: inline-block;
}