the text is not getting justified. html:- <span class="allText"> my text of arounf 25 lines </span> css:- .allText{ text-align:justify; font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica,
sans-serif; font-size:14px; }
The simplest solution will be to use divs instead of spans. Why are you using span in this situation? Since spans are inline elements, it takes width according to the text inside it, so it's width is floating with the content. But div on the other hand,
has a fixed width so it's easier to align text with divs.
If you need to get the inline behaviour while having the text aligned, you can use a div and set the display style to display:inline-block.
ogsim07
Participant
967 Points
733 Posts
css text align : justify not working for my span tag.
Feb 27, 2012 10:59 AM|LINK
Ruchira
All-Star
44332 Points
7194 Posts
MVP
Re: css text align : justify not working for my span tag.
Feb 27, 2012 11:10 AM|LINK
Hi,
The simplest solution will be to use divs instead of spans. Why are you using span in this situation? Since spans are inline elements, it takes width according to the text inside it, so it's width is floating with the content. But div on the other hand, has a fixed width so it's easier to align text with divs.
If you need to get the inline behaviour while having the text aligned, you can use a div and set the display style to display:inline-block.
Hope it helps you...
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.MetalAsp.Net
All-Star
112752 Points
18373 Posts
Moderator
Re: css text align : justify not working for my span tag.
Feb 27, 2012 11:14 AM|LINK
ogsim07
Participant
967 Points
733 Posts
Re: css text align : justify not working for my span tag.
Feb 27, 2012 11:31 AM|LINK
Ruchira
All-Star
44332 Points
7194 Posts
MVP
Re: css text align : justify not working for my span tag.
Feb 27, 2012 02:39 PM|LINK
I'm afraid that I don't see any other way to achieve the text-alignment. :(
As far as I know, alignments won't work for inline elements. Instead you can use divs with display set to inline-block.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.