Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-12-31 23:42:19

uselessness
Member
From: Albuquerque, NM
Registered: 2006-11-06
Posts: 17
Website

Stop auto-wrapping images with paragraph tags

I want article images to float to the right so that text will wrap around them, and I’ve set “img” this way in styles so that none of my group blog’s authors will have to worry about using a particular class to do that. Problem is, images within articles get wrapped in <p> tags by Textile — making my styles pointless.

Can I make Textile realize that images are not paragraphs, and stop wrapping them?

I tried placing <img> tags inside the paragraphs I want them to float beside, which sort of works. But if the image is taller than the paragraph it’s in, the next paragraph won’t come up beside it too; instead, it sits down underneath the image, creating a big gap between paragraphs of text on the page. I don’t want to break the flow of the article. Any suggestions?

Offline

#2 2007-01-01 01:33:03

uselessness
Member
From: Albuquerque, NM
Registered: 2006-11-06
Posts: 17
Website

Re: Stop auto-wrapping images with paragraph tags

Any help at all on floating images with Textpattern would be much appreciated.

I think I’ve found a way to stop my images from being wrapped in <p> tags, which means I can now float them. Still can’t get the text to wrap underneath the image when it reaches the picture’s bottom though… it maintains the narrower width until the end of the paragraph, then the next paragraph is the proper width. Odd. I wonder if it has anything to do with the <span> tags is Textile wrapping paragraphs in. Wonder why it’s doing that.

Last edited by uselessness (2007-01-01 01:45:30)

Offline

#3 2007-01-01 05:25:44

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Stop auto-wrapping images with paragraph tags

This is made up of two parts: how Textile works and how CSS and markup work together.

  • Anything not contained with a paragraph or other block tag will act strangely when sitting next to other block tags.
  • Textile starts a new paragraph whenever you stick something on a line all by itself.

Therefore, you need to do 1 of 2 things: either keep your images on the same line as your text, or apply your style to the paragraph containing the image, rather than the image itself.

Since the first doesn’t look the way you want, you’ll have to do the second.

Offline

#4 2007-01-01 07:35:11

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Stop auto-wrapping images with paragraph tags

you can also put a space before the image tags – and textile won’t touch it

one paragraph

[space][tag for your image]

next paragraph here

Offline

#5 2007-04-10 17:53:14

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: Stop auto-wrapping images with paragraph tags

Wow, that [space] trick is amazing. Kind of wacky, but sure saved me from all sorts of more complicated work-arounds. Thanks!

Offline

Board footer

Powered by FluxBB