Text flowing around image

Hey upssjw!

Great point! If you want to ensure two columns on larger screens and keep it single-column on smaller ones, here’s how you can adjust it with Tailwind:

<div class="columns-1 lg:columns-2 gap-5 text-justify">
  <img src="/resources/aqua.jpg" alt="Description of the image" class="float-left mr-4 w-36 h-auto">
  Some text that will flow around the image like a graceful river around a rock. Keep adding more text here to see the effect in action. The text will start in the first column and flow into the second, maintaining a neat and tidy look.
</div>

This setup ensures:

  • columns-1 for a single column on smaller screens.
  • lg:columns-2 for two columns on large screens and above.

If there’s anything else you need or any more tweaks, just give me a shout! :blush:

my earlier non-tailwind version worked. This is only producing 1 column no matter the screen width.

Hey ercross!

It sounds like Tailwind might be acting a bit shy. :sweat_smile: Let’s double-check the setup. Make sure Tailwind CSS is properly linked in your project. If it’s all set, here’s a quick recap of the Tailwind setup:

<div class="columns-1 lg:columns-2 gap-5 text-justify">
  <img src="/resources/aqua.jpg" alt="Description of the image" class="float-left mr-4 w-36 h-auto">
  Some text that will flow around the image like a graceful river around a rock. Keep adding more text here to see the effect in action. The text will start in the first column and flow into the second, maintaining a neat and tidy look.
</div>

This should give you:

  • columns-1 for a single column on smaller screens.
  • lg:columns-2 for two columns on large screens and above.

If it’s still not working, double-check your Tailwind setup or try clearing your cache. If you need more help, just holler! :blush:

what about break inside

Hey upssjw!

Ah, the elusive break-inside property! It can be quite handy for controlling how content breaks within columns. If you’re looking to keep elements from breaking awkwardly, you can use it like this:

<div class="columns-1 lg:columns-2 gap-5 text-justify">
  <img src="/resources/aqua.jpg" alt="Description of the image" class="float-left mr-4 w-36 h-auto break-inside-avoid">
  Some text that will flow around the image like a graceful river around a rock. Keep adding more text here to see the effect in action. The text will start in the first column and flow into the second, maintaining a neat and tidy look.
</div>

The break-inside-avoid class helps prevent the image from splitting across columns. Make sure your Tailwind setup includes this utility, or you might need to add it manually.

If you need more help or want to tweak it further, just give me a shout! :blush:

@ercross

basic, more controls for columns etc and layout

elementsapp://downloadDocument/3Jh2ZC3fGsAi

Hi Steve,

I’m trying to do it using the Single Post component of the CMS with Markdown.

You’re example as a custom component works, but I don’t know how I could integrate that into the CMS.

apologies missed you initial post, yes you can use in a blog post, will the float and columns be your format for every post or only certain posts

this is the css version, just going to work now, so just an example, tailwind version slightly different

Try copying in the tailwind version, instead of the css version

If you wanted this as your template for every post you could do this a different way

The CSS version works in the individual post, but the Tailwind version doesn’t.

I tried doing it on the Post template page using a custom component and using {{item.body}} to bring in the text, but that doesn’t seem to work. Not sure if that is supported or I ‘m just not using the proper syntax.

https://sjwjaw.co.uk/blogsp/?item=today

This is only testing pages not real website, I am only use one page this not two pages kind of menu structured through the pages icon

This page is using float custom component to pull in an image, title and body/text very minimum float code in here

Tailwind version requires add info to work in markdown

Not sure if this what you are trying to do

I have posted the entire project on this forum somewhere not sure if I deleted though if I can find in my bin I can post the project again

Collection and item create templates so this uses the same template in every post, wants to follow the template every post

Just need to add the column code to the custom component

Hi Steve,

Yes that is exactly what I’m trying to do with the column code as well. Setting it in the template means less coding in the markdown file, so I’m perfectly fine with all the blog posts being formatted the same way.

I’m at work so no access to mac

Hi Steve,

No rush, I appreciate your help. I’m digging out of 20 inches of snow over here in Massachusetts.

Component in project just copy to your project

ok no controls just modified quickly, it was just for testing

this is as much as I tested image or background just set to cms and size, then drop in the typography component and set to {{item.body}}

elementsapp://downloadDocument/OGyHihA3NUFU

Hi Steve,

Thanks, I put the float component on the page and followed the instructions. It populates, but it is only showing one column. I looked in the html code and don’t see any column code. Am I missing something?

I set lg:columns-2 so will not switch to 2 columns until it reaches that width see video the sm md lg are the blue dots in Elements

try changing lg: to sm: or md: remove lg: and replace with one of those

float column

elementsapp://downloadDocument/qGEYzO19a7Hs

very basic cms setup

I set up the typography a little

Hi Steve,

This was perfect and I like the added dividing line. This should make creating my markdown files much simpler, rather than having CSS code in them.

Will you be developing any Elements add-ons that will be available through the marketplace? Or is there a way I can send a donation?

No donation required

The component needs controls and additional structure, it was only for concept layouts

Just remember you are locked into the template, columns, you can still add images videos links lists through css html, but will always be in columns