spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / corecss / 1 To page 1To page 2To page 3To page 4To page 5To page 6current page
[previous]

Core CSS: Chapter 11: Text Properties: Extensions

Senior Lotus Notes Developer
AMS Staffing Solutions
US-MD-Baltimore

Justtechjobs.com Post A Job | Post A Resume
Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

TEXT-JUSTIFY PROPERTY

Often, when you use a justification value on the text contained within a Web page, you might wish to have greater control over how exactly a line of text is to be justified across the length of a paragraph. For the most part a Web browser will either squeeze the space between letters or expand them slightly, but the adjustments made do not always look good. The text-justify property provides much greater control over the type of justification use.

The text-justify property has a total of eight separate values: auto, distribute, distribute-all-lines, inter-cluster, inter-ideograph, inter-word, kashida and newspaper. The auto value is the default, allowing the browser to determine how to best justify a line of text. The distribute value is intended for use with Asian character sets, and justifies every line of text in a vertical paragraph save for the last line. The distribute-all-lines value is also intended for Asian character sets, and works the same way as distribute, but it applies the justification to all lines of text in a block of text, including the final line. Both inter-cluster and inter-ideograph are similarly intended for Asian character sets, the first justifies lines of text containing no inter-word spacing, the second increasing or decreasing the width between characters or words as necessary. The inter-word value increases or decreases the spacing between individual words, though this is applied to the final line of text in the paragraph. The kashida value is specific to Arabic characters, and it justifies the text by exaggerating certain characters at specific points. Finally, the newspaper value increases or decreases the spaces between words, and works the same way as distribute -- which similarly does not justify the final line of text -- but it is intended for Western text. This property is meant to be used in conjunction with the text-align property set to justify.

Listing 11-9 shows some simple English text on a page using the default auto value as well as the distribute-all-lines values for text-justify.

Listing 11-9 text-justify Sample Code

<html>
<head>
<title>text-justify Example</title>
<style>
body {font-size: 20pt}
p {text-align:justify; width: 550px; font-weight: bold}
</style>
</head>
<body>
text-justify: auto (the default)
<p style="text-justify: auto">
The quick fox jumped over the lazy dog.
The quick fox jumped over the lazy dog.
The quick fox jumped over the lazy dog.
The quick fox jumped over the lazy dog.
</p>
text-justify: distribute-all-lines
<p style="text-justify: distribute-all-lines">
The quick fox jumped over the lazy dog.
The quick fox jumped over the lazy dog.
The quick fox jumped over the lazy dog.
The quick fox jumped over the lazy dog.
</p>
</body>
</html>

Figure 11-10: Two values for Internet Explorer's text-justify property displayed.

The effects of the text-justify values can be seen in Figure 11-10. The first paragraph really just displays the effects of text-align: justify which is set to both paragraphs on the page, but the second shows the distinct effect of distribute-all-lines value for text-justify, which justifies each and every line of text by increasing the space between individual letter and words in the final line of the paragraph.

CSS3 and text-justify

The CSS3 text module introduces a new property called text-script which copies many of the effects value names for text-justify. The text-justify property shares the values auto, distribute, inter-cluster, inter-ideograph, inter-word, kashida and newspaper (as well as the ubiquitous CSS3 values initial and inherit) but dispenses with distribute-all-lines. Given that Microsoft, who make Internet Explorer is a member of the World Wide Web Consortium, they are likely to implement these values as the text-script property. For more information on this property, see the section devoted to this property in Chapter 10, "Text Properties"

home / programming / corecss / 1 To page 1To page 2To page 3To page 4To page 5To page 6current page
[previous]

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags

Created: March 11, 2003
Revised: August 19, 2003

URL: http://webreference.com/programming/corecss/1