Search code examples
htmlcsswordpressdivide

How to split an HTML code into two columns with image on the right?


I'm using wordpress to build a website and currently have the about page done but I want to add images to the right hand side of the page. I cannot put in any css into the template because it already has its own css. It accepts html tags though. So how would I go about getting the three images I want on the right hand side of the page? Here is the code that I do have:

<div id="header">
  <h4 style="color: #6f9458;">Welcome to the Greens at Amyclae!</h4>
</div>

<div id="content">
  <div class="col">
    <p>my text here </p>
    <h6 style="color: #6f9458;">Overview</h6>
    <p>more text here</p>
   <h6> Stafford County Public Schools serve the Greens at Amyclae 
subdivision.</h6>
    <ul>
        <li>Winding Creek Elementary School</li>
        <li>Rodney Thompson Middle School</li>
        <li>Colonial Forge High School</li>
    </ul>
    <h6 style="color:#6f9458">Management Agency:
    Corporation
    Fredericksburg, VA 22401 </h6>
  </div>

  <div class="col" style="float:right">
    <img src="sample.jpg" alt="">
  </div>
</div>

Here is what I'm looking for:

enter image description here


Solution

  • You could try something like this. The image is floating right but the paragraph tag will wrap around the image.

    <div style="overflow:hidden;background-color:blue;width:100%">
      <img src="http://via.placeholder.com/150x50" alt="" style="float:right">
      <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.
      </p>
    </div>
    
    <div style="overflow:hidden;background-color:#000088;width:100%">
      <img src="http://via.placeholder.com/150x75" alt="" style="float:right">
      <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.
      </p>
    </div>

    https://jsfiddle.net/DanielGale/jkebwL0b/