1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
---
title: شناسه
slug: Web/HTML/Global_attributes/id
translation_of: Web/HTML/Global_attributes/id
---
<div dir="rtl">{{HTMLSidebar("Global_attributes")}}</div>
<div dir="rtl"><strong><code>id</code> {{glossary("global attribute")}} (صفت سراسری <code>id</code>)</strong> شناسه (ID) ایست که باید در تمام سند بیهمتا باشد. هدف آن شناسایی عنصری خاص به هنگام پیوند دادن (با استفاده از <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Identifying_resources_on_the_Web#Fragment">شناسهی تکه</a>)، اسکریپتنویسی، یا طراحی ( با {{glossary("CSS")}}) است.</div>
<div>{{EmbedInteractiveExample("pages/tabbed/attribute-id.html","tabbed-shorter")}}</div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples </a> and send us a pull request.</p>
<div class="blockIndicator warning">
<p dir="rtl">مقدار این صفت یک رشتهی مبهم است، به این معنی که نویسندگان وب نباید از آن برای رساندن اطلاعاتی که برای انسان قابل خواندن است استفاده کنند.</p>
</div>
<p dir="rtl">مقدار <code>id</code> نباید حاوی {{glossary("whitespace")}} (فاصلهها، تبها و مانند آن) باشد. در شناسه هایی که حاوی فاصلهی سفید (whitespace) هستند، مرورگرها فاصلهی سفید را بخشی از شناسه در نظر میگیرند. برخلاف صفت {{htmlattrxref("class")}}، که مقادیر جداشده با فاصله را مجاز میداند، عنصرها تنها میتوانند یک مقدار شناسه داشته باشند. </p>
<div class="blockIndicator note">
<p dir="rtl"><strong>پانویس: </strong>استفاده از کاراکترهایی بجز حروف {{glossary("ASCII")}} (اسکی)، ارقام، <code>'_'</code>، <code>'-'</code> و <code>'.'</code> ممکن است موجب مشکلات سازگاری شود؛ چون در HTML 4 مجاز نبودند. اگرچه این محدودیت در{{glossary("HTML5")}} برداشته شدهاست؛ برای سازگاری، شناسه باید با حرف آغاز شود.</p>
</div>
<h2 id="مشخصات">مشخصات</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">مشخصه</th>
<th scope="col">وضعیت</th>
<th scope="col">توضیح</th>
</tr>
<tr>
<td>{{SpecName('HTML WHATWG', "dom.html#the-id-attribute", "id")}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>No change from latest snapshot, {{SpecName('HTML5.1')}}</td>
</tr>
<tr>
<td>{{SpecName('HTML5.1', "dom.html#the-id-attribute", "id")}}</td>
<td>{{Spec2('HTML5.1')}}</td>
<td>Snapshot of {{SpecName('HTML WHATWG')}}, no change from {{SpecName('HTML5 W3C')}}</td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', "dom.html#the-id-attribute", "id")}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td>Snapshot of {{SpecName('HTML WHATWG')}}, now accept <code>'_'</code>, <code>'-'</code> and <code>'.'</code> if not at the beginning of the id. It is also a true global attribute.</td>
</tr>
<tr>
<td>{{SpecName('HTML4.01', 'struct/global.html#adef-id', 'id')}}</td>
<td>{{Spec2('HTML4.01')}}</td>
<td>Supported on all elements but {{HTMLElement("base")}}, {{HTMLElement("head")}}, {{HTMLElement("html")}}, {{HTMLElement("meta")}}, {{HTMLElement("script")}}, {{HTMLElement("style")}}, and {{HTMLElement("title")}}.</td>
</tr>
</tbody>
</table>
<h2 id="سازگاری_مرورگر">سازگاری مرورگر</h2>
<p>{{Compat("html.global_attributes.id")}}</p>
<h2 id="همچنین_ببینید">همچنین ببینید</h2>
<ul>
<li>.همهی <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes">صفتهای سراسری</a></li>
<li>{{domxref("Element.id")}} که بازتاب کنندهی این صفت است.</li>
</ul>
|