Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. SVGUseElement
  4. href

SVGUseElement: href property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

Thehref read-only property of theSVGUseElement interface reflects thehref orxlink:hrefDeprecated attribute of the given element.

Value

AnSVGAnimatedString object.

Examples

Given the following SVG:

html
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">  <defs>    <circle cx="50" cy="50" r="40" fill="blue" />    <circle cx="50" cy="50" r="40" fill="red" />  </defs>  <use href="#circle1" x="50" y="50" />  <use href="#circle2" x="100" y="50" /></svg>

We can access thehref attribute of the<use> elements:

js
const uses = document.querySelectorAll("use");console.log(uses[0].href.baseVal); // output: "#circle1"console.log(uses[1].href.baseVal); // output: "#circle2"

Specifications

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGURIReference__href

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp