Meta content text html charset unicode

Meta content text html charset unicode

Тег (от англ. meta information — мета информация) определяет данные (они называются ещё метатеги), которые используются для хранения информации, предназначенной для браузеров и поисковых систем.

Например, механизмы поисковых систем обращаются к метатегам для получения описания сайта, ключевых слов и других данных. Разрешается использовать более чем один метатег, все они размещаются в контейнере . Как правило, атрибуты любого метатега сводятся к парам « имя=значение », имена которых определяются ключевыми словами content , name или http-equiv .

Синтаксис¶

Закрывающий тег не требуется.

Атрибуты¶

charset Задаёт кодировку документа. content Устанавливает значение атрибута, заданного с помощью name или http-equiv . http-equiv Предназначен для конвертирования метатега в заголовок HTTP. name Имя метатега, также косвенно устанавливает его предназначение.

charset¶

Указывает кодировку документа. Атрибут введён в HTML5 и предназначен для сокращения формы , которая задавала кодировку в предыдущих версиях HTML и XHTML.

Название кодировки, например UTF-8.

Значение по умолчанию

content¶

content устанавливает значение атрибута, заданного с помощью name или http-equiv . Атрибут content может содержать более одного значения, в этом случае они разделяются запятыми или точкой с запятой.

Некоторые значения атрибута content для , предназначенных для поисковых роботов, приведены в табл. 1.

Табл. 1. Значения для meta name=»robots»

Значение Описание
index Разрешает роботу индексировать данную страницу.
noindex Запрещает роботу индексировать текущую страницу. Она не попадает в базу поисковика и её невозможно будет найти через поисковую систему.
follow Разрешает роботу переходить по ссылкам на данной странице.
nofollow Запрещает роботу переходить по ссылкам на данной странице. При этом всем ссылкам не передаётся ТИЦ (тематический индекс цитирования) и PagePank.
noarchive Запрещает роботу кэшировать данную страницу.

Допустимые значения атрибута content для , которые предназначены для управления просмотром сайта на мобильных устройствах, приведены в табл. 2.

Читайте также:  Static methods and properties php

Табл. 2. Значения для meta name=»viewport»

Значение Допустимые значения Описание
width device-width или целое положительное число Устанавливает ширину области просмотра в пикселях.
height device-height или целое положительное число Устанавливает высоту области просмотра в пикселях.
initial-scale Число от 0.0 до 10.0 Устанавливает соотношение между шириной устройства (device-width в портретном режиме или device-height в ландшафтном режиме) и размером области просмотра.
maximum-scale Число от 0.0 до 10.0 Задаёт максимальное значение масштаба. Должно быть больше или равно minimum-scale, в противном случае игнорируется.
minimum-scale Число от 0.0 до 10.0 Задаёт минимальное значение масштаба. Должно быть меньше или равно maximum-scale, в противном случае игнорируется.
user-scalable yes или no Если указано no, то пользователь не сможет масштабировать веб-страницу. По умолчанию используется yes.

Строка символов, которую надо взять в одинарные или двойные кавычки.

Значение по умолчанию

http-equiv¶

Браузеры преобразовывают значение атрибута http-equiv , заданное с помощью content , в формат заголовка ответа HTTP и обрабатывают их, как будто они прибыли непосредственно от сервера.

Любой подходящий идентификатор. Ниже приведены некоторые допустимые значения атрибута http-equiv .

Content-Type Тип кодировки документа.

expires Устанавливает дату и время, после которой информация в документе будет считаться устаревшей.

pragma Способ кэширования документа.

refresh Загружает другой документ в текущее окно браузера.

Значение по умолчанию

name¶

Устанавливает идентификатор метатега для пары « имя=значение ». Одновременно использовать атрибуты name и http-equiv не допускается.

Любой подходящий идентификатор. Ниже приведены некоторые допустимые значения атрибута name .

author Имя автора документа. description Описание текущего документа. keywords Список ключевых слов, встречающихся на странице. viewport Управляет просмотром сайта на мобильных устройствах.

Значение по умолчанию

Спецификации¶

Описание и примеры¶

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 html> head> title>METAtitle> meta charset="utf-8" /> meta name="GENERATOR" content="Microsoft FrontPage 4.0" /> meta name="ProgId" content="FrontPage.Editor.Document" /> head> body> p>. p> body> html> 

Источник

: The metadata element

The HTML element represents metadata that cannot be represented by other HTML meta-related elements, like , , , or .

  • , : a element. If the http-equiv is not an encoding declaration, it can also be inside a element, itself inside a element.
  • : any element that accepts metadata content.
  • : any element that accepts metadata content or flow content.

The type of metadata provided by the element can be one of the following:

  • If the name attribute is set, the element provides document-level metadata, applying to the whole page.
  • If the http-equiv attribute is set, the element is a pragma directive, providing information equivalent to what can be given by a similarly-named HTTP header.
  • If the charset attribute is set, the element is a charset declaration, giving the character encoding in which the document is encoded.
  • If the itemprop attribute is set, the element provides user-defined metadata.

Attributes

This element includes the global attributes.

Note: the attribute name has a specific meaning for the element, and the itemprop attribute must not be set on the same element that has any existing name , http-equiv or charset attributes.

This attribute declares the document’s character encoding. If the attribute is present, its value must be an ASCII case-insensitive match for the string «utf-8» , because UTF-8 is the only valid encoding for HTML5 documents. elements which declare a character encoding must be located entirely within the first 1024 bytes of the document.

This attribute contains the value for the http-equiv or name attribute, depending on which is used.

Defines a pragma directive. The attribute is named http-equiv(alent) because all the allowed values are names of particular HTTP headers:

  • content-security-policy Allows page authors to define a content policy for the current page. Content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks.
  • content-type Declares the MIME type and the document’s character encoding. The content attribute must have the value «text/html; charset=utf-8» if specified. This is equivalent to a element with the charset attribute specified and carries the same restriction on placement within the document. Note: Can only be used in documents served with a text/html — not in documents served with an XML MIME type.
  • default-style Sets the name of the default CSS style sheet set.
  • x-ua-compatible If specified, the content attribute must have the value «IE=edge» . User agents are required to ignore this pragma.
  • refresh This instruction specifies:
    • The number of seconds until the page should be reloaded — only if the content attribute contains a non-negative integer.
    • The number of seconds until the page should redirect to another — only if the content attribute contains a non-negative integer followed by the string ‘ ;url= ‘, and a valid URL.

    Pages set with a refresh value run the risk of having the time interval being too short. People navigating with the aid of assistive technology such as a screen reader may be unable to read through and understand the page’s content before being automatically redirected. The abrupt, unannounced updating of the page content may also be disorienting for people experiencing low vision conditions.

    The name and content attributes can be used together to provide document metadata in terms of name-value pairs, with the name attribute giving the metadata name, and the content attribute giving the value.

    See standard metadata names for details about the set of standard metadata names defined in the HTML specification.

    Examples

    meta charset="utf-8" /> meta http-equiv="refresh" content="3;url=https://www.mozilla.org" /> 

    Specifications

    Browser compatibility

    BCD tables only load in the browser

    See also

    Found a content problem with this page?

    This page was last modified on Jul 18, 2023 by MDN contributors.

    Your blueprint for a better internet.

    MDN

    Support

    Our communities

    Developers

    Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
    Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.

    Источник

Оцените статью