addImport method (styleSheet)
Imports an external style file into the current styleSheet object.
In other words, the addImport method inserts an @import rule into the current styleSheet object. The imports collection represents the imported style sheets for a styleSheet object in Internet Explorer. The addImport method creates a new styleSheet object and inserts it into the imports collection of the current styleSheet object. insertRule method to insert a rule into a styleSheet object in Firefox, Opera, Google Chrome, Safari and Internet Explorer from version 9.
You can find the related objects in the Supported by objects section below.
|Required. String that specifies the location of the style file to import.|
|Optional. Integer that specifies the position for the newly created styleSheet object in the imports collection. If this value is negative or greater than the length of the imports collection, the styleSheet is added to the end of the collection. Default is -1.|
Returns the index of the newly added stylesheet in the imports collection. This value is a zero-based integer.
Example HTML code 1:
This example illustrates the use of the addImport method:
Did you find this example helpful?
User Contributed Comments