Link to home
Start Free TrialLog in
Avatar of gisvpn
gisvpnFlag for United States of America

asked on

CSS Text Justification

Hello,

Can anyone comment on why the text-align justify part below does not work ?

thanks,

GISVPN
the CSS ...
 
.article_txt{
font-family: Trebuchet MS;
font-size: 14px;
line-height: 15pt;
text-align: justify;
}
 
 
the HTML ...
 
<td width="365"><span class="article_txt">Some TEXT in a CELL</span</td>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jgmontgo
jgmontgo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gisvpn

ASKER

Great thanks for the info....


</span should be </span> ... sorry my typing error in the post, the original was </span>..

If the text is shorter than a full line it is not justified, if it is longer it is justified ... sorry again, the post just had example text in it, the original had lots of text.

 
the class needs to be moved to the <td> then the span can be removed ... that was the problem ! Moving to the TD made it work. Why did the SPAN method not work ?


The CSS also had a font name that should be in quotes although this is not a serious issue - fixed thanks..
Avatar of gisvpn

ASKER

Great thanks for the information. Much appreciated.
Kravimir is right that "It did not work with the <span> because the <span> is an inline element." If you find the actual usage of text-align: justify it is actually designed to work inside a table. The basic idea is that you have to have a constrained area with a defined right and lest side in order to justify, otherwise the browser would have no idea what to justify against.
Thanks for the points.