JSFiddle - React, Tailwind, and code Playground
by SwampFall
HTML
<div class="msg_wrapper you">
<div class="msgspace">
<div class="msgblock you mby">
<div class="msg">
Lorem ipsum
</div>
<div class="timespace">
<div class="timerel">
<span class="time">13:24</span>
</div>
</div>
</div>
</div>
<div class="picspace">
<div class="picrel">
<img class="pic" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRYXVTbxmHQuOogxDeNx7U6z7neHX4kOQPZEBLG5nzQZoMMhkFN"/>
</div>
</div>
</div>
CSS
body, html {
font-family: Verdana, sans-serif;
}
.other {
float: left;
}
.you {
float: right;
}
.mbo {
background: lime;
border-radius: 2px 10px 10px 2px;
}
.mbo:first-child {
border-radius: 10px 10px 10px 2px;
}
.mbo:last-child {
border-radius: 2px 10px 10px 10px;
}
.mbo:only-child {
border-radius: 10px;
}
.mby {
background: yellow;
border-radius: 10px 2px 2px 10px;
}
.mby:first-child {
border-radius: 10px 10px 2px 10px;
}
.mby:last-child {
border-radius: 10px 2px 10px 10px;
}
.mby:only-child {
border-radius: 10px;
}
.msg_wrapper {
display: flex; /* equal height of the children */
max-width: 60%;
margin: 5px;
}
.msgspace {
flex: 1;
}
.msgblock {
display: flex;
padding: 3px;
margin: 2px;
border-radius: 10px;
width: fit-content;
}
.msg {
flex: 1;
padding: 2px;
}
.timespace {
font-size: 8px;
flex: 0;
width: 30px;
}
.timerel {
position: relative;
height: 100%;
width: 30px;
}
.time {
position: absolute;
bottom: 5px;
}
.picspace {
flex: 0; /* additionally, equal width */
width: 40px;
padding: 5px;
}
.picrel {
position: relative;
width: 40px;
height: 100%;
}
.pic {
max-width: 40px;
max-height: 40px;
position: absolute;
bottom: 0px;
}