quotes style property

Browser support:
8
Specifies or returns the pairs of quotation marks for the 'open-quote' and 'close-quote' values of the content property.
Note: The quotes property is supported in Internet Explorer from version 8.

Syntax:

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

Possible values:

The type of this property is string.
 One of the following values: 
 This value can be used arbitrary times (use the space character to separate them) 
 Values in this order (use the space character to separate them): 
1. open-quote
2. close-quote
pairs of quotation marks
none
inherit

Description of values:

close-quote
String, represents the closing quotation mark.
inherit
Takes the value of this property from the computed style of the parent element.
none
Produce no quotation marks for the 'open-quote' and 'close-quote' values of the content property.
open-quote
String, represents the opening quotation mark.
pairs of quotation marks
Pairs of quotation marks for the 'open-quote' and 'close-quote' values of the content property.
Default: none.

Example HTML code 1:

This example illustrates the use of the quotes property:
<head>
    <style>
        .example {
            quotes: "<" ">" "[begin]" "[end]";
        }
    </style>
</head>
<body>
    <q class="example">This is a <q>quoted element</q> in an outer quoted element</q>
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the quotes property in JavaScript:
<head>
    <style>
        .example {
            quotes: "<" ">" "[begin]" "[end]";
        }
    </style>

    <script type="text/javascript">
        function ChangeQuotation () {
            var selectTags = document.getElementsByTagName ("select");
            var quoteValue = "";

            for (i = 0; i < selectTags.length;i++) {

                // Returns the index of the selected option
                var whichSelected = selectTags[i].selectedIndex;

                // Concatenates the text of the selected option
                quoteValue += '"' + selectTags[i].options[whichSelected].text + '" ';
            }

            var quote = document.getElementById ("myQuote");

            if ('quotes' in quote.style) {
                quote.style.quotes = quoteValue;
                
                // solve refresh problems on Opera
                quote.className = "";
                quote.focus ();
                quote.className = "example";
            } else {
                alert ("Your browser doesn't support this example!");
            }
        }
    </script>
</head>
<body>
    <q id="myQuote" class="example">
        This is a <q>quoted element</q> in an outer quoted  element
    </q>
    <br />

    <select onchange="ChangeQuotation ();" size="6">
        <option />'
        <option selected="selected" />&lt;
        <option />(
        <option />|
        <option />&ldquo;
        <option />&bdquo;
    </select>
    <select onchange="ChangeQuotation ();" size="6">
        <option />'
        <option selected="selected" />&gt;
        <option />)
        <option />|
        <option />&rdquo;
        <option />&bdquo;
    </select>
    <select onchange="ChangeQuotation ();" size="5">
        <option />'
        <option selected="selected" />[begin]
        <option />{open}
        <option />&bdquo;
        <option />&lt;first&gt;
    </select>
    <select onchange="ChangeQuotation ();" size="5">
        <option />'
        <option selected="selected" />[end]
        <option />{close}
        <option />&bdquo;
        <option />&lt;last&gt;
    </select>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content