JSFiddle - React, Tailwind, and code Playground
by mynameisdonald
HTML
<div class="msgwrapper">
<span class="timestamp">14:04</span>
<span class="clientname">Donald: </span>
<span class="clientmessage">hello</span>
</div>
CSS
div.msgwrapper div.msghead{
background: rgb(247,247,247); /* Old browsers */
background: -moz-linear-gradient(top, rgba(247,247,247,1) 0%, rgba(242,242,242,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(247,247,247,1)), color-stop(100%,rgba(242,242,242,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(247,247,247,1) 0%,rgba(242,242,242,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(247,247,247,1) 0%,rgba(242,242,242,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(247,247,247,1) 0%,rgba(242,242,242,1) 100%); /* IE10+ */
background: linear-gradient(top, rgba(247,247,247,1) 0%,rgba(242,242,242,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#f2f2f2',GradientType=0 ); /* IE6-9 */
-webkit-border-top-left-radius: 3px;
-webkit-border-top-right-radius: 3px;
-moz-border-radius-topleft: 3px;
-moz-border-radius-topright: 3px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
width:100%;
position:relative;
float:left;
}
div.msgwrapper span.timestamp {
position:relative;
float:right;
text-align:right;
width:18%;
}
div.msgwrapper span.clientname {
width:10em;
display:inherit;
position:relative;
float:left;
-webkit-border-top-left-radius: 3px;
-moz-border-radius-topleft: 3px;
border-top-left-radius: 3px;
}
div.msgwrapper span.clientmessage {
position:relative;
float:left;
width:100%;
background:#fff;
}
JavaScript
$(document).ready(function(){
var group = $("div.msgwrapper span").not(".clientmessage");
$(group).wrapAll('<div class="msghead" />');
});