how can I keep text from line breaking?

TechBoyJK

Lifer
Oct 17, 2002
16,699
60
91
For instance, say I have a link that says "please click here for help"

It is supposed to be directly below a graphic. If the graphic (which changes dynamically) is thin enough, the text will appear to the right of the graphic and link break half way through, instead of all of the text being below the graphic..

I could use a <br> after the photo to force the text below the graphic, but if the graphic is wide enough, it adds an extra break..

Is there any way to group text so that it is "all or none" in regards to line breaks?

 

TechBoyJK

Lifer
Oct 17, 2002
16,699
60
91
Originally posted by: Bulldog13
<p style="float:left">Text that I don't want broken </p>

That might work.

cool... i didnt try that yet though.. it seems along with a <BR> tag, there is also a tag called <NOBR> </NOBR> that you can wrap around text to prevent breaking.. it works so far....
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Read up a little on the difference between block and inline elements and how they are affected by CSS styles, and you'll be able to get much better control. Paragraphs and spans, as well as text literals, are inline elements and display in line-order by default. A <div> on the other hand is a block element and each new block displays below the previous block, by default.

So if you have something like this...

<div><img src="blah" /></div>
<div>caption</div>

The second div will always display below the first given default styles. Add a containing div to enforce width or height and you have a cell:

<div style="width: 100px; height: 100px;">
<div><img src="blah" /></div>
<div>caption</div>
</div>

If you play around with it a little bit you'll see what I mean.