title: CSS Chat Bubbles with float
body: <p>I'm trying to design a chat window with messages from the user on the right and messages from the other person on the  left. At first, I tried doing this without <code>floats</code> and failed. Doing some research I found that this was usually done using <a href="https://stackoverflow.com/questions/38915094/simple-html-css-buble-chat">floats</a>. I rewrote it using <code>floats</code> but it still isn't working.</p>
  
  <p>Update: Are <strong>floats</strong> the best solution for this type of design?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.user {
    float: right;
    background-color: deepskyblue;
    margin-right: 20px;
    font-size: 25px;
    color: white;
  }
  
  .friend {
    float: left;
    background-color: orchid;
    margin-left: 20px;
    font-size: 25px;
    color: white;
  }
  
  .clearfix::after {
    content: "";
    clear: both;
    display: table;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div contenteditable="true" class="user clearfix"&gt;
      Have you completed the css chat tutorial
    &lt;/div&gt;
    &lt;div contenteditable="true" class="friend clearfix"&gt;
      No I did not.
    &lt;/div&gt;
    &lt;div contenteditable="true" class="user clearfix"&gt;
      Is it working?
    &lt;/div&gt;
    &lt;div contenteditable="true" class="friend clearfix"&gt;
      NO :(
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>