You are here: Reference > JavaScript > client-side > style handling > properties > layoutGrid

layoutGrid style property

Browser support:
Specifies or returns up to four separate layout-grid properties that specify the layout of text characters.
If you want to display characters that use a one or two-dimensional grid layout, such as Chinese and Japanese, you can use the layoutGrid property to display them properly in web pages.

Syntax:

object.layoutGrid;
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: layout-grid

Possible values:

The type of this property is string.
 Values in this order (use the space character to separate them): 
1.
<layout-grid-mode> possible but not necessary; left to personal choice
2.
<layout-grid-type> possible but not necessary; left to personal choice
3.
 Values in this order (use the space character to separate them): 
1. <layout-grid-line>
2.
<layout-grid-char> possible but not necessary; left to personal choice
possible but not necessary; left to personal choice

Description of values:

layout-grid-char
Specifies or returns the size of the character grid for the layout of an element's text content.
layout-grid-line
Specifies or returns the gridline value used for laying out Japanese or Chinese characters in a web document.
layout-grid-mode
Specifies or returns whether the text layout grid uses one or two dimensions.
layout-grid-type
Specifies or returns the type of grid to be used for laying out Japanese or Chinese characters in a web document.
Default: both loose none none.

Example HTML code 1:

This example illustrates the use of the layout-grid property:
<head>
    <style>
        .example {
            layout-grid: both fixed 15px 15px;
        }
    </style>
</head>
<body>
    <div class="example">layout-grid: both fixed 15px 15px</div>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the layoutGrid property in JavaScript:
<head>
    <script type="text/javascript">
        function ChangeLayout () {
            var selectTags = document.getElementsByTagName ("select");
            var layoutValue = "";
            
            for (i = 0; i < selectTags.length; i++) {
                // Returns the index of the selected option
                whichSelected = selectTags[i].selectedIndex;

                // Returns the selected options values
                layoutValue += selectTags[i].options[whichSelected].text + " ";
            }

            var div = document.getElementById ("myDiv");

            if ('layoutGrid' in div.style) {
                div.style.layoutGrid = layoutValue;
            } else {
                alert ("Your browser doesn't support this example!");
            }
        }
    </script>
</head>
<body>
    <div id="myDiv">Change the value of the layout-grid property</div>

    <br />
    layout-grid-mode:
    <select onchange="ChangeLayout ();" size="4">
        <option selected="selected" />both
        <option />none
        <option />line
        <option />char
    </select>
    layout-grid-type:
    <select onchange="ChangeLayout ();" size="3">
        <option selected="selected" />loose
        <option />strict
        <option />fixed
    </select>
    layout-grid-line:
    <select onchange="ChangeLayout ();" size="6">
        <option />5px
        <option />25px
        <option />40px
        <option />60px
        <option />auto
        <option selected="selected" />none
    </select>
    layout-grid-char:
    <select onchange="ChangeLayout ();" size="7">
        <option />5px
        <option />10px
        <option />15px
        <option />30px
        <option />45px
        <option />auto
        <option selected="selected" />none
    </select>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content