Home > Mobile >  How do I move the image to the right side of the text? Help me please
How do I move the image to the right side of the text? Help me please

Time:10-02

So I have this code for my assignment but I can't figure out how to make the image goes to the side of the text. It keeps going to the right corner. Can someone help me out please? I just started to learn CSS. Thank you in advance.

<div >
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
    </div>
    <button >Example</button>
    <button >Example</button><br>
    <img src="cy.png" alt="IMG">

enter image description here

CodePudding user response:

Make a table

<table>
<tr>
<td>
    <div >
        Lorem ipsum dolor sit amet, consectetur adipiscing elit
    </div>
    <button >Example</button>
    <button >Example</button><br>
</td>
<td>
    <img src="cy.png" alt="IMG">
</td>
</table>

CodePudding user response:

Could you clarify, are you trying to get it to go to the right side of text?

Typically, the align property of the img tag is what you want, and you usually want it before the thing you are trying to align it with.

I also recommend sharing a jsFiddle so that people can play with the code.

<img src="https://images.pexels.com/photos/13728847/pexels-photo-13728847.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" alt="IMG" align="right">
<div >
  Lorem ipsum dolor sit amet, consectetur adipiscing elit
</div>
<button >Example</button>
<button >Example</button><be>

https://jsfiddle.net/f1e7b6d8/

  • Related