spacer

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

home / programming / corecss / 1 To page 1To page 2To page 3To page 4current pageTo page 6To page 7
[previous] [next]

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

Listing 11-6 layout-grid-char Sample Code

<html>
<head>
<title>layout-grid-char Example</title>
</head>
<style>
div {font-family: PMingLiU; layout-grid-mode: both; layout-flow: vertical-ideographic; font-weight: bold; font-size: 15pt}
</style>
<body>
Chinese text with no <code>layout-grid-char</code> value set (<code>font-size</code> set to 15pt)
<div>
&#20320;&#21487;&#23559;&#20320;&#35201;&#20834;&#25237;&#30340;&#36008;&#29289;&#21152;&#35387;&#25104;"&#29305;&#23531;&#38917;&#30446;"&#65292;&#25110;"&#29305;&#21029;&#35201;&#27714;&#38917;&#30446;"&#12290;&#25152;&#26377;"&#29305;&#23531;&#38917;&#30446;"&#25110;"&#29305;&#21029;&#35201;&#27714;&#38917;&#30446;"&#22343;&#26371;&#24471;&#21040;&#29305;&#21029;&#34389;&#29702;
&#12290;&#20363;&#22914;&#65306;&#23427;&#20497;&#26371;&#34987;&#25918;&#32622;&#22312;&#20834;&#25237;&#32178;&#38913;&#30340;&#39318;&#38913;&#12289;&#21450;&#22312;&#20854;&#20182;&#32178;&#38913;&#19978;&#29992;&#21152;
&#31895;&#23383;&#39636;&#39023;&#31034;&#12290;&#21152;&#35387;&#36027;&#29992;&#28858;&#27599;&#38917;&#32654;&#20803;&#20116;&#21313;&#20803;&#12290;
</div>
Same Chinese text set to <code>layout-grid-char: 15pt</code>
<div style="layout-grid-char: 15pt">
&#20320;&#21487;&#23559;&#20320;&#35201;&#20834;&#25237;&#30340;&#36008;&#29289;&#21152;&#35387;&#25104;"&#29305;&#23531;&#38917;&#30446;"&#65292;&#25110;"&#29305;&#21029;&#35201;&#27714;&#38917;&#30446;"&#12290;&#25152;&#26377;"&#29305;&#23531;&#38917;&#30446;"&#25110;"&#29305;&#21029;&#35201;&#27714;&#38917;&#30446;"&#22343;&#26371;&#24471;&#21040;&#29305;&#21029;&#34389;&#29702;
&#12290;&#20363;&#22914;&#65306;&#23427;&#20497;&#26371;&#34987;&#25918;&#32622;&#22312;&#20834;&#25237;&#32178;&#38913;&#30340;&#39318;&#38913;&#12289;&#21450;&#22312;&#20854;&#20182;&#32178;&#38913;&#19978;&#29992;&#21152;
&#31895;&#23383;&#39636;&#39023;&#31034;&#12290;&#21152;&#35387;&#36027;&#29992;&#28858;&#27599;&#38917;&#32654;&#20803;&#20116;&#21313;&#20803;&#12290;
</div>
</body>
</html>

Figure 11-7: Internet Explorer showing off the differences in spacing between vertical characters when a value is set to layout-grid-char

Figure 11-7 shows the effects of layout-grid-char on our sample of Chinese text -- the section to where it has been applied expands the spacing between vertical characters, displaying five characters per line instead of ten characters per line in the default sample. The way this setting works is that it sets the spacing value between each character. So in the second example, the layout-grid-char value is set to equal that of the font-size of the Chinese characters, so it ends up placing half as many characters along each vertical line, and twice as many lines are needed to display all of the characters. Even though there is significant spacing between the characters in the second example, the spacing of the lines remains the same -- there may be more lines of characters, but layout-grid-char does not affect the spacing between the lines of characters.

Same as with layout-grid-line, layout-grid-char does not take negative values, and it must be applied to a block-level elements.

According to Microsoft's documentation, in order for these properties to work, layout-grid-mode must be set to either line or both -- though in our tests it did not matter if layout-grid-mode was present, as the presence of layout-grid-line or layout-grid-char seemed to be enough to do the trick.

layout-grid Property

The layout-grid property is a shortcut property to all of the rest of the layout-grid family of properties, and like all such shortcut properties, it allows Web authors to quickly set multiple parameters at once. The values must be placed in this order: first the layout-grid-mode value, then layout-grid-type followed by layout-grid-line and layout-grid-char. The default setting for layout-grid is the default values for each of these individual properties in succession: both loose none none.

Using this shortcut property you can easily and quickly make formatting changes to sections or all of the Asian text on your Web pages. The default setting for displaying such text on a Web page tends to be very compact, which can make the characters hard to read, especially if the characters are rather small. Using layout-grid you can make wholesales changes all at once.

Listing 11-7 shows some Japanese text, the first without any special layout-grid settings, the second using layout-grid: both loose 10pt 5pt. The results can be see in Figure 11-8.

Listing 11-7 layout-grid Sample Code

<html>
<head>
<title>layout-grid Example</title>
</head>
<style>
div {font-family: "MS Mincho"; layout-flow: vertical-ideographic; font-size: 15pt}
</style>
<body>
Unformatted Japanese text
<div>
&#12399;&#12501;&#12521;&#12483;&#12488;&#12497;&#12493;&#12523;&#12487;&#12451;&#12473;&#12503;
&#12524;&#12452;&#26989;&#30028;&#12398;&#29420;&#31435;&#12375;&#12383;&#12509;&#12540;&#12479;
&#12523;&#12469;&#12452;&#12488;&#12391;&#12289;&#38651;&#23376;&#21462;&#24341;&#12469;&#12540;
&#12499;&#12473;&#12434;&#34892;&#12387;&#12390;&#12362;&#12426;&#12414;&#12377;&#12290;&#39321;
&#28207;&#12289;&#12488;&#12525;&#12531;&#12488;&#65288;&#12459;&#12490;&#12480;&#65289;&#12289;
&#12525;&#12531;&#12489;&#12531;&#65288;&#12452;&#12462;&#12522;&#12473;&#65289;&#12395;&#12354;
&#12427;&#31169;&#12393;&#12418;&#12398;&#12458;&#12501;&#12451;&#12473;&#12424;&#12426;&#12289;
&#12450;&#12472;&#12450;&#12289;&#12520;&#12540;&#12525;&#12483;&#12497;&#12289;&#12450;&#12513;
&#12522;&#12459;&#12434;&#12459;&#12496;&#12540;&#12375;&#12390;&#12362;&#12426;&#12414;&#12377;
&#12290;&#31169;&#12393;&#12418;&#12399;<b>&#12464;&#12525;&#12540;&#12496;&#12523;</b>&#12394;
&#27963;&#21205;&#12434;&#34892;&#12387;&#12390;&#12362;&#12426;&#12289;&#12414;&#12383;&#31478;
&#22770;&#12399;<b>&#21311;&#21517;</b>&#12392;&#12375;&#12390;&#12362;&#12426;&#12414;&#12377;
&#12290;&#31169;&#12393;&#12418;&#12399;&#30342;&#27096;&#12364;&#19990;&#30028;&#20013;&#12398;
&#12497;&#12540;&#12488;&#12490;&#12540;&#12392;&#21311;&#21517;&#12395;&#12390;&#12362;&#21462;
&#24341;&#12391;&#12365;&#12427;&#12424;&#12358;&#25903;&#25588;&#12373;&#12379;&#12390;&#12356;
&#12383;&#12384;&#12356;&#12390;&#12362;&#12426;&#12414;&#12377;&#12290;
</div>
Same Japanese text using <code>layout-grid: both loose 10pt 5pt</code>
<div style="layout-grid: both loose 10pt 5pt">
&#12399;&#12501;&#12521;&#12483;&#12488;&#12497;&#12493;&#12523;&#12487;&#12451;&#12473;&#12503;
&#12524;&#12452;&#26989;&#30028;&#12398;&#29420;&#31435;&#12375;&#12383;&#12509;&#12540;&#12479;
&#12523;&#12469;&#12452;&#12488;&#12391;&#12289;&#38651;&#23376;&#21462;&#24341;&#12469;&#12540;
&#12499;&#12473;&#12434;&#34892;&#12387;&#12390;&#12362;&#12426;&#12414;&#12377;&#12290;&#39321;
&#28207;&#12289;&#12488;&#12525;&#12531;&#12488;&#65288;&#12459;&#12490;&#12480;&#65289;&#12289;
&#12525;&#12531;&#12489;&#12531;&#65288;&#12452;&#12462;&#12522;&#12473;&#65289;&#12395;&#12354;
&#12427;&#31169;&#12393;&#12418;&#12398;&#12458;&#12501;&#12451;&#12473;&#12424;&#12426;&#12289;
&#12450;&#12472;&#12450;&#12289;&#12520;&#12540;&#12525;&#12483;&#12497;&#12289;&#12450;&#12513;
&#12522;&#12459;&#12434;&#12459;&#12496;&#12540;&#12375;&#12390;&#12362;&#12426;&#12414;&#12377;
&#12290;&#31169;&#12393;&#12418;&#12399;<b>&#12464;&#12525;&#12540;&#12496;&#12523;</b>&#12394;
&#27963;&#21205;&#12434;&#34892;&#12387;&#12390;&#12362;&#12426;&#12289;&#12414;&#12383;&#31478;
&#22770;&#12399;<b>&#21311;&#21517;</b>&#12392;&#12375;&#12390;&#12362;&#12426;&#12414;&#12377;
&#12290;&#31169;&#12393;&#12418;&#12399;&#30342;&#27096;&#12364;&#19990;&#30028;&#20013;&#12398;
&#12497;&#12540;&#12488;&#12490;&#12540;&#12392;&#21311;&#21517;&#12395;&#12390;&#12362;&#21462;
&#24341;&#12391;&#12365;&#12427;&#12424;&#12358;&#25903;&#25588;&#12373;&#12379;&#12390;&#12356;
&#12383;&#12384;&#12356;&#12390;&#12362;&#12426;&#12414;&#12377;&#12290;
</div>
</body>
</html>

Figure 11-8: Internet Explorer depicting Japanese text; the first with no layout-grid values set, the second using layout-grid: both loose 10pt 5pt

Here's what's going on in Figure 11-8: the both setting (which is the equivalent to layout-grid-mode: both) ensures that the formatting is added to both block-level as well as inline elements; loose is the correct layout-grid-type value for Japanese text; the 10pt value sets a 10-point spacing between each successive line, (equivalent to layout-grid-line: 10pt); and the 5pt value adds an equivalent spacing between each individual character displayed (same as layout-grid-char: 5pt).

The end result as can be seen in Figure 11-8 not only shows the text more spaced-out on the page, but it is arguably easier to make out individual characters, and hence to read the text. Of course there are limits to this -- space the text too widely on a page and you'll end up forcing your users to do a lot of horizontal scrolling in order to read all of your text. But used judiciously, layout-grid can enhance the overall readability of your text, and display it more elegantly on the Web page.

home / programming / corecss / 1 To page 1To page 2To page 3To page 4current pageTo page 6To page 7
[previous] [next]

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 27 2003
Revised: August 19, 2003

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