tags:

views:

67

answers:

4

code

<a href="#" style="width:50px;white-space:normal">Hello how are you</a>

output

Hello how are you

Why it's not rendering like this I need like this.

Hello
how 
are 
you

how to achieve output like this without changing in HTML?

<p style="width:165px;height:80px;border:1px solid red">

  <a href="#" style="width:80px;white-space:normal">Hello how are you</a>

  </p>

See live example here http://jsbin.com/amozu4

i need link like this

Hello
how 
are 
you
A: 

you can get that using this :

a { white-space:normal;}
Puaka
tried, not working
metal-gear-solid
weird.. its working on Ie7,chrome and FF. do you have other css attached to that page ?
Puaka
see it's not working http://jsbin.com/amozu4
metal-gear-solid
+1  A: 

If you're going to render a list, then make it a list. Even if it means repeating the link for each item.

<ul style="list-style:none;">
  <li><a href="#">london</a></li>
  etc

The advantage of this is that you can also at any time make it a sentence, by making all li elements display:inline.

Tor Valamo
no i can't change HTML.
metal-gear-solid
of course you can. otherwise it wouldn't make sense to do that, unless it's homework?
Tor Valamo
Now why the down-vote, I wonder? +1 because it's the best, and most valid, suggestion made so far.
David Thomas
A: 

Adding display:block;width:40px;white-space:normal works for me.

kim3er
`white-space:normal` not necessary
metal-gear-solid
+3  A: 
<a style="width:40px;display:inline-block;">
Tor Valamo
yes it's working now, display:block also working.
metal-gear-solid
see working example here http://jsbin.com/amozu4/3
metal-gear-solid