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

layoutGridChar style property

Browser support:
Specifies or returns the size of the character grid for the layout of an element's text content.
This property has effect only if the layoutGridMode property is set to line or both, and only applies to block elements.

Syntax:

object.layoutGridChar;
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-char

Possible values:

The type of this property is string.
 One of the following values: 
auto
Character grid is to be dependent on the largest character.
none
Default. Character grid is not used.
size in non-negative length
The size of the character grid in length units. For the supported length units, see the length page.
size in non-negative percentage
The size is the specified percentage of the height of parent element.
Default: none.

Example HTML code 1:

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

Example HTML code 2:

This example illustrates the use of the layoutGridChar property in JavaScript:
<head>
    <script type="text/javascript">
        function ChangeLayout (selectTag) {
            // Returns the index of the selected option
            var whichSelected = selectTag.selectedIndex;

            // Returns the selected options values
            var layoutValue = selectTag.options[whichSelected].text;

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

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

    <br />
    <select onchange="ChangeLayout (this);" 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