JSFiddle - React, Tailwind, and code Playground
by Diego Vieira
HTML
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<ol class="discussion">
<li class="other">
<div class="avatar">
<img src="http://s3-us-west-2.amazonaws.com/s.cdpn.io/5/profile/profile-80_9.jpg" />
</div>
<div class="messages">
<p>yeah, they do early flights cause they connect with big airports. they wanna get u to your connection</p>
<time datetime="2009-11-13T20:00">Timothy • 51 min</time>
</div>
</li>
<li class="self">
<div class="avatar">
<img src="http://cdn.screenrant.com/wp-content/uploads/Rocket-Raccoon-in-Guardians-of-the-Galaxy-international-trailer.jpg" />
</div>
<div class="messages">
<p>That makes sense.</p>
<p>It's a pretty small airport.</p>
<time datetime="2009-11-13T20:14">37 mins</time>
</div>
</li>
<li class="other">
<div class="avatar">
<img src="http://s3-us-west-2.amazonaws.com/s.cdpn.io/5/profile/profile-80_9.jpg" />
</div>
<div class="messages">
<p>that mongodb thing looks good, huh?</p>
<p>
tiny master db, and huge document store</p>
</div>
</li>
</ol>
<div class="chatPad">
<div class="col col-10">
<textarea></textarea>
</div>
<div class="col col-2">
<button><span class="fa fa-chevron-right"></span></button>
</div>
</div>
CSS
html, body {
height:100%;
}
body {
padding:0;
margin:0;
}
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.discussion {
height:90%;
list-style: none;
background: #e5e5e5;
margin: 0;
padding: 0 0 50px 0;
}
.discussion li {
padding: 0.5rem;
overflow: hidden;
display: flex;
}
.discussion .avatar {
width: 40px;
position: relative;
}
.discussion .avatar img {
display: block;
width: 100%;
height:100%;
}
.other .avatar:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border: 5px solid white;
border-left-color: transparent;
border-bottom-color: transparent;
}
.self {
justify-content: flex-end;
align-items: flex-end;
}
.self .messages {
order: 1;
border-bottom-right-radius: 0;
}
.self .avatar {
order: 2;
width:40px;
height:40px;
}
.self .avatar:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 0;
border: 5px solid white;
border-right-color: transparent;
border-top-color: transparent;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}
.messages {
background: white;
padding: 10px;
border-radius: 2px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.messages p {
font-size: 0.8rem;
margin: 0 0 0.2rem 0;
}
.messages time {
font-size: 0.7rem;
color: #ccc;
}
.chatPad {
height:10%;
}
.chatPad .col {
float:left;
}
.chatPad .col-10 {
width:90%;
}
.chatPad .col-2 {
width:10%;
}
.chatPad textarea {
border:1px solid #e1e1e1;
width:100%;
}