Kelsey Greenwood
Kelsey Greenwood

Reputation: 67

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

Upvotes: 0

Views: 2473

Answers (3)

Piotr S.
Piotr S.

Reputation: 1

If you don't want to modify the themes' css (it's actually better not to do it) or to create a child theme (it's not always really necessary), and you're familiar with css, adding classes and ids, you can use a plugin like this one: https://pl.wordpress.org/plugins/custom-css-js/ and put your css there. If it makes any problems it's easy to reverse (by simply deleting the modified code within this plugins' menu) with no harm to the theme.

Upvotes: 0

Daniel Gale
Daniel Gale

Reputation: 663

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/

Upvotes: 1

selami
selami

Reputation: 2498

You can use inline style.

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

Upvotes: 1

Related Questions