This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.


Property of css/cssom/propertiescss/cssom/properties


var result = element.viewInheritStyle;
element.viewInheritStyle = value;


The content of the primary document is shown in the code snippet below. In the following sample a div tag contains a custom element that has an element behavior attached to it. The div tag that is located in the primary document sets a number of CSS attributes, specifically the following:

  • [**color**](/html/attributes/color) is set to red.
  • [**fontSize**](/css/properties/font-size) is set to 12 pt.
  • [**fontStyle**](/css/properties/font-style) is set to italic.
  • [**border**](/css/properties/border) is set to 2px solid blue.
  • ``` html
    This text is inside a DIV element in the primary document.

    The next code snippet shows the content of the HTC file,

    The HTC file contains a simple document fragment, which also includes a div tag that uses the following CSS styles.

  • [**fontSize**](/css/properties/font-size) is set to 20 pt.
  • [**border**](/css/properties/border) is set to 2px solid green.
  • Because the content in the primary document has CSS styles set on a **div** tag that contains the custom element, the **div** tag in the document fragment inherits the inheritable CSS Styles when the **viewInheritStyle** property is true.
    <public:component tagName="abc">
    <attach event="oncontentready" onevent=init() />
    function init(){
    defaults.viewInheritStyle = false;
    docFragCaption.innerText = "viewInheritStyle is now set to false";
    function btnChangeInheritance_onClick(){
    boolInherit = defaults.viewInheritStyle;
        if (boolInherit == true) {
        defaults.viewInheritStyle = false;
        docFragCaption.innerText = "viewInheritStyle is now set to false";
        defaults.viewInheritStyle = true;
        docFragCaption.innerText = "viewInheritStyle is now set to true";
    <DIV id="docFragCaption" style= "font-size:20pt;border:2px solid green"></DIV>
    <INPUT id=btnChangeInheritance type=button value="Toggle viewInheritStyle property" onclick="btnChangeInheritance_onClick()">



    For more information on the CSS styles that can be inherited when viewInheritStyle is set to true, see About Viewlink CSS Inheritance. Inheritable CSS styles are only applied to elements in the document fragment that do not already have the corresponding CSS styles defined.


    See also

    Related pages

    • defaultSelecteddefaultSelected
    • Conceptual
    • Introduction to Viewlink
    • About Viewlink CSS Inheritance
    • About Element Behaviors