title: Putting a Border Around Floating Elements
body: <p>Say I have something like the following code, where I want to display some text between two images that I am floating left and right.</p>
  
  <pre><code>&lt;img src="testImage1.png" alt="Test Image 1" style="float:right;" /&gt;
  &lt;img src="testImage2.png" alt="Test Image 2" style="float:left;" /&gt;
  &lt;p&gt;Test Text&lt;/p&gt;
  </code></pre>
  
  <p>I want to add a border around the two images and the text. I tried putting a <code>&lt;div&gt;</code> around all 3 of the above tags and using <code>style="border:2px black solid;"</code>. While this adds a border, it seems to not take the images into account. That is, we get something like the following (using StackOverflow and Google logos). </p>
  
  <p><img src="https://i.stack.imgur.com/HBDaZ.png" alt="enter image description here"></p>
  
  <p>I am guessing this is happening because the floating elements are not being considered as part of the <code>&lt;div&gt;</code>. I am a software developer, not a web developer, so I am no expert in CSS. But I do think I recall that floating elements are kind of "ignored" in a way. Can anyone give a detailed description of what is going on and how to fix it? </p>