Hyphenation and justification together with CSS?

liunx

Guest
If you've used page layout editor such as Quark XPress, you'd know that when you create a text box and paste text into it, Quark understands the words and not only it can justify text by the size of the text box, but also hyphenate it.

Well, basically I'm looking for something like

text-align: justify;
text-align: hyphenate;

I know justify works. But I also want hyphenation too. Thanks.

jamesI'm getting closer to finding the solution. This:

word-break: break-all

breaks the word, but not exactly accurately and it doesn't insert the hyphen itself

<!-- m --><a class="postlink" href="http://www.w3.org/TR/2003/CR-css3-text-20030514/#word-break-insideSince">http://www.w3.org/TR/2003/CR-css3-text- ... nsideSince</a><!-- m --> this is a CSS3 property, browser support is unreliable at best (or nonexistent in many cases). For the moment, you may be able to manually use a soft hyphen (&shy;), but it's a bit more work. See the specification (<!-- m --><a class="postlink" href="http://www.w3.org/TR/html4/struct/text.html#h-9.3.3">http://www.w3.org/TR/html4/struct/text.html#h-9.3.3</a><!-- m -->) for more details.

AdamCSS does not handle hyphenation. "Hyphenation is not described in CSS because different languages have different hyphenation rules. Rather than try to concoct a set of rules that would most likely be incomplete, the specification simply avoids the problem." - Eric Meyer, "Cascading Style Sheets: A Definite Guide", Second edition, (c) 2004 O'Reilly

Remember, the CSS specs are universal, not just for English.If my option is to use &shy character, would search engines be okay with it? Would they be confused by a dash splitting the word that's being searched?

Also when I preview the &shy character in Netscape -- it is spelled out as a word (not good!). For example hyphenating the word "coverage" (cove-rage), in IE the cove&shyrage will show as
cove-
rage
but in Netscape it shows as cove&shyrage

jamesAs far as search engines are concerned, they should ignore it, though its possible they won't. From the specification:

For operations such as searching and sorting, the soft hyphen should always be ignored.
I don't know what is causing the Netscape bug. Browser support is a little patchy for the character - you might try the numerical version of the entity, (­).

Adaminstead of &shy try ­
try including the semi-colon and see if that works
 
Back
Top