View Full Version : Mozilla Links wrapping

10-04-2007, 12:23 PM

I'm dynamically displaying links to a web page.
They are contained in a div.


<div id="ans">&nbsp;[% question.q_answer %]</div>


#ans {
font-family: Verdana, sans-serif;
font-size: 11px;
line-height: 125%;
border: none;
padding: 0px 2px 5px 2px;
margin: 0px 0px 0px 3px;
color: #000000;

The links wrap fine with IE6, but goes way beyond the screen boundary for Firefox and Netscape when the links are very long.

Any suggestions on how to prevent this?

Thanks in advance

10-04-2007, 03:20 PM
Containers are not supposed to grow for content too big to fit them, they are supposed to flow out of the container like Firefox and Netscape do. That's the behavior outlined in the CSS spec, and IE6 actually gets it wrong.

Really you could do one of two things: 1.) Do some massaging server-side to either cut off some of the link length with ellipses or 2.) use an overflow = hidden to hide the overflow.

Obviously something in the realm of #1 would be a better approach.

10-04-2007, 03:36 PM
What's the output of the link?

If it's one continuous stream of text (like vtjustinb describes) then what he says is the way to go.

But if the output is supposed to be something like <div id="ans">&nbsp;View the answer of this question</div> there's always the chance that your backend is displaying non-breaking spaces (i.e., &nbsp;). I actually had something similar happen to me…it took forever to track it down and then it was just a matter of replacing the non-breaking space with a regular one.

10-04-2007, 04:27 PM
Thanks for your help guys.
Yes its a continuous stream of text rmedek,
so im going to use overflow = auto as suggested.