--- title: id slug: Web/SVG/Attribute/id tags: - SVG - SVG Attribute - SVG 属性 translation_of: Web/SVG/Attribute/id --- <div>{{SVGRef}}</div> <p><strong><code>id</code></strong> 属性は要素に固有の名前を割り当てます。</p> <p>すべての要素がこの属性を使用します。</p> <div id="topExample"> <pre class="brush: html notranslate"><svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <style type="text/css"> <![CDATA[ #smallRect { stroke: #000066; fill: #00cc00; } ]]> </style> <rect id="smallRect" x="10" y="10" width="100" height="100" /> </svg> </pre> <p>{{EmbedLiveSample("topExample", "120", "120")}}</p> </div> <h2 id="Usage_notes" name="Usage_notes">使用上の注意</h2> <table class="properties"> <tbody> <tr> <th scope="row">値</th> <td><id></td> </tr> <tr> <th scope="row">既定値</th> <td><em>None</em></td> </tr> <tr> <th scope="row">アニメーション</th> <td>いいえ</td> </tr> </tbody> </table> <dl> <dt><id></dt> <dd> <p>要素の ID を指定します。 ID はノードツリー内で固有でなければならず、空文字列であってはならず、ホワイトスペース文字を含んではなりません。</p> <div class="blockIndicator note"> <p><strong>注:</strong> URL の対象フラグメントとして使用されるときに <code>id</code> の値に SVG view 仕様書として解釈される値 (例えば <code>MyDrawing.svg#svgView(viewBox(0,200,1000,1000))</code>) や、基本メディアフラグメントを使用しないでください。</p> </div> <p>XML 文書内で妥当でなければなりません。独立した SVG 文書は XML 1.0 の構文を使用しており、有効な ID は指定された文字 (文字、数字、いくつかの句読点) のみを含み、数字、フルストップ (.) 文字、ハイフンマイナス (-) 文字で始まらないことを指定しています。</p> </dd> </dl> <h2 id="Specifications" name="Specifications">仕様書</h2> <table class="standard-table"> <thead> <tr> <th scope="col">仕様書</th> <th scope="col">状態</th> <th scope="col">備考</th> </tr> </thead> <tbody> <tr> <td>{{SpecName("SVG2", "struct.html#IDAttribute", "id")}}</td> <td>{{Spec2("SVG2")}}</td> <td>Defines the allowed values in more detail.</td> </tr> <tr> <td>{{SpecName("SVG1.1", "struct.html#IDAttribute", "id")}}</td> <td>{{Spec2("SVG1.1")}}</td> <td>初回定義</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> <p>{{Compat("svg.attributes.style.class")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li><a href="/ja/docs/Web/HTML/Global_attributes/id">HTML <code>id</code></a></li> <li>{{SVGAttr("class")}}</li> </ul>