Responsive Layout with Image Problem

I’m unable to get the text in the second column to flow around the image inserted mid paragrgh. Also after the image the text takes on the width set for the image even though the image is contained ithin its own div.

I have column1 one floating left. Column2 floating right. I am tring to insert an image within column two and get the image to float right an the text to flow around it.

I am stuck now…anyone have a solution or better (or correct!!!) method of nesting please??

Here is the file…
Codepen Test Layout File

Thanks in advance


First thing is it looks like you didn’t close the image tag before the closing div tag.

From there does this get you what you wanted?

#chakra {
  display: inline-block;
  text-align: center;
  width: 100%;
img {
    max-width: 100px;


thanks for the reply and code.
The text has returned to standard width - due to the “display: inline-block” - thanks.
The issue still remains that the text does not wrap around the image.
Using dev tools I can see that the chakra div takes up the width of the container. Even when I set the div width to 40% it still seems to take up rest of the row. And so no text flowing around it. Im not sur how to stop the chakra div from tking up the width of its parent container (.col-2)?

For some unkown reason there was a right border on the chakra div the width of the col-2 container.
I’ve removed that now but the text still doesn’t wrap.
any ideas?

Try moving the image to the top of col-2, then this:

#chakra {
  padding-left: 50px;
img {
  float: right;
  width: 100px;
  margin: 15px;


It definitely works but…I will not want every image added after this to float to the right. So I was tring to get the chakra image to float right individually without making a universal declaration. Does that make sense?
This might make a good FCC challenge!!!

something like this?

Getting there!
I want to float the image to the right.
I have just managed to get it to work ‘if’ I remove the chakra div from within the paragraph and place it just before. This looks like I wanted but what if i wanted the image to appear mid paragraph? A new para and place image inbetween?
Codepen link updated to reflect above :slight_smile:
BUT image moves outside of it’s parent when making browser window small!!! :frowning:

You can be specific about which image you want it applied to, i.e.:

#chakra img {
  float: right;
  width: 100px;
  margin: 15px;

ahh right…that might be it then! Well done :slight_smile:

YES - You have Solved it - Thanks for your input. It was driving me nuts!!!
Looks like thats the way to do it for all images added.

I dont see why I cant float within an already floated container but looks like thats just how it is!!!
Thanks again to you and erretres. :slight_smile:

1 Like

Instead of creating a bunch of IDs or definitions on a case-by-case basis, why not create a “general” rule? Remember, you can add more than one class to an element to style it. Maybe do something like this:

    float: right;
    float: left;
    width: 100px;
    margin: 15px;

Then you could use it like this:

<img class='img-small float-right' src='...' />

thats a good idea…thanks.
The less typing the better!!!