niko
niko

Reputation: 9393

how do i align the span tags in div tag in a well designed way?

Well Im stucked at this point.please take a look at this http://jsfiddle.net/karthik64/5jhgF/3/

Okay first enter some input into the input box and hit enter you would see a span element added to the div and try to input some more values and I guess you got what the problem is.Could anyone tell me how do i fit those <span> tags in <div> tag in a nice manner.

I have set my div tag width and using javscript I add some elements to div tag and I get some kind of wierd bugs something like for example . if user enters dennis ritchie , steve jobs and bill gates my code works likes this

   ..dennis ritchie..  ..steve jobs.. ..bil
   l gates..

Instead it should be like this

  ..dennis ritchie.. ..steve jobs..
  ..bill gates..

if it cannot fit the span tag in that remaining space, I want the whole span tag element jump to next line instead of breaking the span tag value how do i do that .please help me with this.any help is greatly appreciated.Thanks

Upvotes: 0

Views: 121

Answers (2)

Neil
Neil

Reputation: 55402

On newer browsers, add display: inline-block; to the .music_elements style rule.

On older browsers, float: left; might work.

Upvotes: 1

Ansel Santosa
Ansel Santosa

Reputation: 8444

<span>s are not block-level elements and are not rendered like you describe by default (they wrap with text). Apply the CSS display: inline-block; to your spans to stop them from wrapping.

Upvotes: 1

Related Questions