By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

URGENT HELP: Text wrapping inside DIV.

P: n/a
Here is my HTML:
<style>
..leftcolumn{float:left;width:300px;border: 1px solid #ccc}
..rtcolumn{float:left;width:600px;border: 1px solid #ccc}
</style>

<body>
<div class="leftcolumn" id="d_links">
multiple <a href="hello.aspx?q=something">something</a><a
href="hello.aspx?q=something1">something1</a><a
href="hello.aspx?q=something2">something2</a><a
href="hello.aspx?q=something3">something3</a><a
href="hello.aspx?q=something4">something4</a><a
href="hello.aspx?q=something5">something5</a>........
</div>
<div id="d_content" class="rtcolumn">
long text here.............................................. ......

</div>
</body>

Issue:
The div with id "d_content" rendered is perfect the problem is with div
with id "d_links". The links(text) inside should wrap within the div
tags width but instead that is generated in one long line expanding the
DIV tag. Irrespective what width I assign to d_links it is rendered in
one line and pushes the d_content to next line in IE, whereas in FF
d_links goes under d_contents.

What is going on here? Any help will be greatly appreciated.

Thanks.

PS: I do not have this in public domain to show what is happening.

Mar 7 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
ze****@gmail.com wrote:

<div class="leftcolumn" id="d_links">
multiple <a href="hello.aspx?q=something">something</a><a
href="hello.aspx?q=something1">something1</a><a
href="hello.aspx?q=something5">something5</a>........
</div>
<div id="d_content" class="rtcolumn">
long text here.............................................. ......
</div>

Issue:
The div with id "d_content" rendered is perfect the problem is with div
with id "d_links". The links(text) inside should wrap within the div
tags width but instead that is generated in one long line expanding the
DIV tag. Irrespective what width I assign to d_links it is rendered in
one line and pushes the d_content to next line in IE, whereas in FF
d_links goes under d_contents.

What does "perfect" mean to you? I have can think of 3 possibilities
right away.
The content of d_links is a solid line of text without whitespace. Where
is there to break?
You could add a <br> explicitly between each link. Or put each link in a
<p>.
Normally though, a list, <ul>, is used to layout a list of items. See
<http://css.maxdesign.com.au/listamatic/>

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Mar 7 '06 #2

P: n/a
My bad there is &nbsp; between each like below:

<div class="leftcolumn" id="d_links">
multiple <a href="hello.aspx?q=something">something</a>&nbsp;<a
href="hello.aspx?q=something1">something1</a>&nbsp;<a
href="hello.aspx?q=something2">something2</a>&nbsp;<a
href="hello.aspx?q=something3">something3</a>&nbsp;<a
href="hello.aspx?q=something4">something4</a>&nbsp;<a
href="hello.aspx?q=something5">something5</a>........
</div>

And the way I want it to be display is like this:
something something1
something2
something3 ....

depending upon the length of the inner text of anchor number of links
are fitted on one line.

When I said perfect, I meant, rendered the way I want it to. Items
inside are rendered without any flowing out or clipping unnecessarily.

I had considered using list but I have seen some site that could do it
without list tag.

Thanks.

Mar 7 '06 #3

P: n/a
On 6 Mar 2006 21:36:51 -0800, ze****@gmail.com wrote:
My bad there is &nbsp; between each like below:

<div class="leftcolumn" id="d_links">
multiple <a href="hello.aspx?q=something">something</a>&nbsp;<a
href="hello.aspx?q=something1">something1</a>&nbsp;<a
href="hello.aspx?q=something2">something2</a>&nbsp;<a
href="hello.aspx?q=something3">something3</a>&nbsp;<a
href="hello.aspx?q=something4">something4</a>&nbsp;<a
href="hello.aspx?q=something5">something5</a>........
</div>

And the way I want it to be display is like this:
something something1
something2
something3 ....


Huh? You mean you are putting NON-BREAKING spaces in and then wondering
why there are no line-breaks? Isn't the answer rather obvious?

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Mar 7 '06 #4

P: n/a
zeyais wrote:
My bad there is &nbsp;


NBSP = Non-Breaking SPace.

There is nowhere to wrap the text.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Mar 7 '06 #5

P: n/a
Stephen Poley <sb******************@xs4all.nl> wrote:
Huh? You mean you are putting NON-BREAKING spaces in and then
wondering why there are no line-breaks? Isn't the answer rather
obvious?


The original poster forgot quite a many elementary principles of
posting to Usenet and specifically to c.i.w.h. groups. _Especially when
you need urgent help_,
- do not multipost
- don't even think of that!
- DO NOT SHOUT, IT HURTS PEOPLE'S EYES AND MAKES YOU LOOK UNFRIENDLY
- do not waste space in the Subject line to tell you need urgent help
- post the URL instead of wasting time in explaining why you are not
doing that
- use your real name, it always improves the impression that you
are serious and constructive.

See my response in c.i.w.a.stylesheets. The really urgent need is to
redesign the page, so that the problem is not created in the first
place.

Using just spaces between links, though common and not the worst of
mortal sins, is not good practice. Using e.g.
<a ...>...</a>&nbsp;| <a ...>...
is better: it puts visible (and audible) separators between the links
(and the &nbsp; prevents the separator from appearing at the start of a
line).

More logically, a list of links is written as a <ul> element, then (if
desired) styled with CSS so that it is rendered effectively as running
text, but there are considerable technical problems with this at
present (especially as regards to producing some visible separators).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Mar 7 '06 #6

P: n/a
ze****@gmail.com wrote:
PS: I do not have this in public domain to show what is happening.


Then we do not have access to your private space to help you.

You've already posted one fragment that was critically inaccurate
(missing &nbsp;) and wasted everyone's efforts, compared to ust posting
a URL. Why should anyone bother to help someone who is deliberately
making things difficult for them?

Mar 7 '06 #7

P: n/a
ze****@gmail.com wrote:

I had considered using list but I have seen some site that could do it
without list tag.

Using a list element, <ul>, for a list of items is semantically correct
and painfully obvious. Who cares that other site's authors do not know how
to use a markup language?

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Mar 7 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.