--- title: '<code>: The Inline Code element' slug: Web/HTML/Element/code tags: - HTML - Код - Элемент translation_of: Web/HTML/Element/code --- <div>{{HTMLRef}}</div> <p id="Summary"><span class="seoSummary"><strong>Элемент HTML <code><code></code></strong> отображает его содержимое в стиле, предназначенном для указания на то, что текст является коротким фрагментом компьютерного кода.</span> По умолчанию текст содержимого отображается с использованием шрифта монопространства по умолчанию {{Glossary("user agent", "пользовательского агента")}}.</p> <div>{{EmbedInteractiveExample("pages/tabbed/code.html", "tabbed-shorter")}}</div> <p class="hidden">Источник для этого интерактивного примера хранится в репозитории GitHub. Если вы хотите внести свой вклад в интерактивный проект примеров, пожалуйста, клонируйте https://github.com/mdn/interactive-examples и пришлите нам <span class="st">запрос на принятие изменений.</span></p> <table class="properties"> <tbody> <tr> <th scope="row"><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></th> <td><a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Flow content</a>, <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">phrasing content</a>, palpable content.</td> </tr> <tr> <th scope="row">Permitted content</th> <td><a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">Phrasing content</a>.</td> </tr> <tr> <th scope="row">Tag omission</th> <td>{{no_tag_omission}}</td> </tr> <tr> <th scope="row">Permitted parents</th> <td>Any element that accepts <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">phrasing content</a>.</td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td><a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role">No corresponding role</a></td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>Any</td> </tr> <tr> <th scope="row">DOM interface</th> <td>{{domxref("HTMLElement")}} Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the {{domxref("HTMLSpanElement")}} interface for this element.</td> </tr> </tbody> </table> <h2 id="Атрибуты">Атрибуты</h2> <p>Этот элемент включает в себя только <a href="/ru/Web/HTML/Global_attributes" title="HTML/Global attributes">глобальные атрибуты</a>.</p> <h2 id="Пример">Пример</h2> <p>Текстовый абзац, включающий <code><code></code>:</p> <pre class="brush: html notranslate"><p>The function <code>selectAll()</code> highlights all the text in the input field so the user can, for example, copy or delete the text.</p> </pre> <p>Вывод, генерируемый этим HTML, выглядит так:</p> <p>{{EmbedLiveSample("Example", 640, 70)}}</p> <h2 id="Примечания">Примечания</h2> <p>Для представления нескольких строк кода, оберните элемент <code><code></code> в элемент {{HTMLElement("pre")}}. Элемент <code><code></code> сам по себе представляет только один элемент кода или строку кода.</p> <p>CSS правило может быть определено для того, чтобы селектор <code>code</code> переопределил шрифт браузера по умолчанию. Предпочтения, установленные пользователем, могут иметь приоритет над указанными CSS.</p> <h2 id="Спецификации">Спецификации</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td>{{SpecName('HTML WHATWG', 'semantics.html#the-code-element', '<code>')}}</td> <td>{{Spec2('HTML WHATWG')}}</td> <td></td> </tr> <tr> <td>{{SpecName('HTML5 W3C', 'textlevel-semantics.html#the-code-element', '<code>')}}</td> <td>{{Spec2('HTML5 W3C')}}</td> <td></td> </tr> <tr> <td>{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '<code>')}}</td> <td>{{Spec2('HTML4.01')}}</td> <td></td> </tr> </tbody> </table> <h2 id="Совместимость_с_браузерами">Совместимость с браузерами</h2> <div class="hidden">Таблица совместимости на этой странице составлена из структурированных данных. Если Вы хотите внести свой вклад в данные, пожалуйста, посетите https://github.com/mdn/browser-compat-data и отправьте нам запрос.</div> <p>{{Compat("html.elements.code")}}</p> <h2 id="См._также">См. также</h2> <ul> <li>{{HTMLElement("samp")}}</li> <li>{{HTMLElement("kbd")}}</li> <li>{{HTMLElement("command")}} (deprecated)</li> <li>{{HTMLElement("var")}}</li> <li>{{HTMLElement("pre")}}</li> </ul>