I'm trying to create a simple chat room using CSS which consist of their message and their username. What I have done is I've wrapped the message and username inside a <div>
. The problem occurs when the message goes over the <div>
. It doesn't push other <div>
s containing other message below.
Thank you for helping me.
here the jsiddle
CSS
body { background-color: #535954}
.box22 { content: "";display: block;clear: both;background-color: #FFFFFF;width: 500px;height:400px;position: relative;left: 450px;top: 230px; }
.user{font-size:18px;font-family:Arial;color: #3A3E42 ;font-weight: bold;float:right;position: relative;left: -20px;top: 0px;}
.message{font-size:18px;font-family:Arial;color: #3A3E42 ;font-weight: bold;float:left;position: relative;left: 10px;top: 40px;}
.wrapper{position: relative;left: 10px;top: 50px;background-color: #FFFFFF;width: 480px;height: 100px}
HTML
<link rel="stylesheet" href="css/float.css">
<div class="box22">
<div class="wrapper">
<span class="user">johnny123 </span>
<span class="message">message message overflow message message overflowmessage message overflowmessage message overflowmessage message overflow</span>
</div>
<div class="wrapper">d
<span class="user">glasses glasses </span>
<span class="message">michael </span>
</div>
</div>