You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > OTextOverflow

OTextOverflow style property

Browser support:
9
Specifies or returns how to handle the overflowed area of text.
Note: The OTextOverflow property is supported in Opera from version 9.

Use the OTextOverflow property together with the overflow style property (with a value different from visible) and the whiteSpace style propery (with a value of nowrap).

In Internet Explorer, Google Chrome and Safari, use the textOverflow property instead of the OTextOverflow property.

Syntax:

object.OTextOverflow;
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: -o-text-overflow

Possible values:

The type of this property is string.
 One of the following values: 
clip
Clips the overflowing text content.
ellipsis
(...) is shown for overflowing text content.
Default: clip.

Example HTML code 1:

This example illustrates the use of the text-overflow and -o-text-overflow properties:
<head>
    <style>
        .example {
            text-overflow: ellipsis;
            -o-text-overflow: ellipsis;
            overflow: hidden;
            width: 120px;
            background: #99C6CD;
            white-space:nowrap;
        }
    </style>
</head>
<body>
    <div class="example" nowrap="nowrap">
        Overflowed text is to be visually clipped.
    </div>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the textOverflow and OTextOverflow properties in JavaScript:
<head>
    <style>
        #myDiv {
            overflow: hidden;
            width: 120px;
            background: #99C6CD;
            white-space:nowrap;
        }
    </style>

    <script type="text/javascript">
        function ChangeTextOverflow (elem) {
            var div = document.getElementById ("myDiv");
 
            if ('textOverflow' in div.style) {
                div.style.textOverflow = elem.innerHTML;
            } else if ('OTextOverflow' in div.style) {
                div.style.OTextOverflow = elem.innerHTML;
            } else {
                alert ("Your browser doesn't support this example!");
            }
        }
    </script>
</head>
<body>
    <div id="myDiv" nowrap="nowrap">
        Overflowed text is to be visually clipped.
    </div>

    <br />
    Change text-overlow property:
    <br />
    <a onclick="ChangeTextOverflow (this)">clip</a>
    <a onclick="ChangeTextOverflow (this)">ellipsis</a>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content