href property (CSSImportRule, styleSheet)
Sets or returns the URL of a linked style sheet.
This property can be used for stylesheets that belong to link elements. If the stylesheet belongs to a style element, the href property is an empty string (Internet Explorer before version 9) or null (in other browsers).
You can find the related objects in the Supported by objects section below.
The href property is read-only in Firefox, Opera, Google Chrome and Safari, and it is read/write in Internet Explorer.
String that specifies or retrieves the URL. It can be an absolute or relative path as well. Relative paths are relative to the base URL. The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the href property:
Did you find this example helpful?
User Contributed Comments