What is the purpose of the sub tag? Physical formatting tags for HTML text

Tag

Tag used to specify the font in lowercase (subscript). Lowercase are reduced-size characters that appear offset downward relative to the rest of the characters in the line. In general, according to the generally accepted definition, symbols lowercase should be positioned below the baseline of the current line, but from all browsers the contents of the container Only Opera displays this way - the rest display characters a little higher.

The baseline is an imaginary line running along the bottom edge of the characters. Some letters (шч, ц, у, д, р, ф) partially extend beyond the baseline.

Attributes

Personal attributes: No.

  • accesskey - Sets the shortcut key for focusing on an HTML element.
  • class - specifies the name of the tag class or classes used in CSS (Cascading Style Sheets).
  • dir - indicates the direction of the text within the element.
  • - specifies the name of an HTML tag identifier that can be used as an “anchor” or in style sheets.
  • lang - indicates the language in which the text inside the HTML element is written.
  • style - required to use built-in CSS styles to tag.
  • tabindex - sets the tab order between elements (Tab key).
  • title - displays a tooltip when you hover the mouse over an HTML element.

Tag type

Purpose: text (strings).

Tag model: inline (built-in, line level).

May contain: inline tags, plain text and HTML special characters(mnemonics).

Opening tag: necessary. Closing tag: necessary.

Syntax

content

HTML Example: Using the SUB Tag

seodon.ru - Using the SUB tag

t n= n!

Here is a description of physical formatting tags. Some of them are not recommended for use by the HTML 4.0 specification for the reasons given above. Some tags have been deprecated by the HTML 4.0 specification, but they continue to be supported by browsers.

Tag

Tag displays text in bold font. In most cases it is recommended instead of a tag use logical formatting tag . For example:

This bold font.

Rice. 1.2. Examples of physical text formatting (Netscape browser)

Tag

Tag displays text in italics. For most cases, it is recommended to use tags instead of this tag , , or , since the latter better reflect the purpose of the selected text. For example:

Selection italics

Tag

Tag displays text in monospace font. For most cases, it is better to use tags instead of this tag , or . Example:

This monospace font.

Tag

Tag displays text underlined. Canceled tag. It is recommended to use tags instead or . For example:

Example underscores text.

Tags And

Tags And display text with a strikethrough horizontal line. Canceled tag. The tag should be used instead . For example:

Example crossed out text.

Currently tag is not supported by all browsers, so for now it is recommended to use in combination with a tag . Namely, inside the container tag you can add a couple of tags

....

Tag

Tag displays text in a font larger (than the unlabeled part of the text) size. Instead of this element it is better to use or title tags, e.g.

Font more size.

Tag

Tag displays text in a smaller font size. Since there is no tag in HTML that is the opposite of the tag , then for these purposes you can use the tag . Most browsers support nested tags , however, this approach is not recommended. For example:

Font less size.

Tag

Tag moves text below line level and displays it (if possible) in a smaller font size. Convenient to use for mathematical indices. For example:

Example font for lower index.

Tag

Tag moves text above line level and displays it (if possible) in a smaller font size. Convenient to use for assigning powers of numbers in mathematics. For example:

Example font for upper index.

Tag

Tag displays flashing text. This tag is not part of the HTML specification and is only supported by the Netscape browser. Experienced developers rarely resort to using this tag, since the presence of blinking characters on the page annoys many users.

Tag

Tag container is analogous to a block level tag

. Can be used when you need to mark a piece of text to set its properties, and cannot use any other structural formatting tag.

The Microsoft Internet Explorer browser additionally allows the use of the following tag parameters: DIR, DATAFLD, DATAFORMATAS, DATASRC. A description of the parameters can be found in the second part of the book.

Rice. 1.3. Using nested text formatting tags

Formatting tags can be nested within each other. In this case, you need to carefully ensure that one container is located entirely in another container. In Fig. Figure 1.3 shows an example of nesting an italic element within a bold element. The following HTML code fragment is used:

This bold font.

This italics.

And here is the text bold and italic

Tag

Tag specifies font options. It refers to text-level physical formatting tags.

Assigning font parameters directly in the document text violates the basic idea of ​​separating the content of the document and describing the form of presentation of the document. Therefore, in the HTML 4.0 specification this tag, as well as the tag classified as cancelled. Their further use is not recommended.

Despite these dire warnings, it appears that physical formatting can be considered acceptable for the simplest documents. In addition, the easiest way to start learning the basics of formatting is with the rules for directly specifying element formats. A novice developer still has to grow up to style design.

Tag refers to sequential elements, so cannot include block level elements, e.g.

Or

.

The following parameters can be set for a tag: FACE, SIZE and COLOR. Note that the Netscape browser also allows the use of two additional parameters: POINT-SIZE and WEIGHT, the description of which is omitted.

    The FACE parameter is used to specify the type of font in which the user's viewer will display text (if such a font is available on the computer). The value of this parameter is the name of the font, which must exactly match the name of the font that the user has. If no such font is found, this instruction will be ignored and the default font will be used.

    You can specify one or several font names, separating them with commas. This is a very useful property, since different systems may have almost identical fonts with different names. Another important quality is to set preferences for using fonts. The font list is scanned from left to right. If the user's computer does not have the first font in the list, an attempt is made to find the next font, and so on.

    Here is an example of using the FACE parameter:

    Purpose of fonts

    An example of specifying a font name.

    In Fig. Figure 1.4 shows how the Netscape browser displays an example. In the example, the Verdana font is indicated as the preferred font; if it is absent, the Arial font will be used, etc.

Rice. 1.4. Netscape browser example display

    This parameter is used to specify font sizes in arbitrary units from 1 to 7. The specific font size depends on the viewer you are using. It is generally accepted that a “normal” font size corresponds to a value of 3.

Default font size settings, as well as the amount of absolute font size change, vary between browsers. In Fig. Figure 1.5 shows the Netscape browser settings window, which sets the default fonts.

The font size is indicated both as an absolute value (SIZE=2) and as a relative value (SIZE=+1). The latter method is often used in combination with setting the base font size using a tag .

Note

When specifying font sizes, entries like "2" and "+2" (unlike most programming languages, in which the unary "+" sign can be omitted) give fundamentally different results.

Here's an example that uses different methods for assigning font sizes. An example display is shown in Fig. 1.6.

Rice. 1.5. Netscape browser font settings window

Rice. 1.6. Assigning font sizes

Assigning font sizes

Font size 1

Font size 2

Font size 3

Font size 4

Font size 5

Font size 6

Font size 7

    This option sets the font color, which can be specified using standard names or in the #RRGGBB format. Here is an example of a document with multi-colored text.

    Choosing a font color

    Green text

    Red text

Tag

Tag used to specify the default font size, type, and color used in a document. These values ​​are required for the entire document, but can be overridden in necessary places using the tag . After the closing tag tag action is being restored. Default font settings can be redefined multiple times in a document, i.e. the tag may appear any number of times in a document.

Note

Tag may also appear in the section document.

Note that for the tag there is no closing tag.

The parameters can be exactly the same as for the tag , namely: FACE, SIZE and COLOR. The purpose and rules for writing parameters are similar.

Note

Netscape browser does not allow FACE tag parameter .

Here is an example of using the tag .

Assigning font sizes

Text written in the default font.

Font size 2.

Font size 4.

Text after table

The example above overrides the default font size twice. Initially it is 3 (default). Then it is set to 2, then 4. Pay attention to the display of this example (Fig. 1.7). It can be seen that for tables the purpose of the tag is It does not work. This is typical for many browsers, although it formally violates the idea of ​​using the tag.

Rice. 1.7. Displaying an example with a tag (Netscape browser)

Text as subscript and superscript:

This text contains subscript text.

This text contains superscript text.

Description and use

Tag defines text as a subscript. A subscript looks like a character below a line. Similar text can be used in chemical formulas: H 2 O.

Tag defines text as a superscript. A superscript looks like a character above a line. Superscript can be used for footnotes: WWW.

Difference between HTML and XHTML

Standard Attributes

Event attributes

Text inside a table cell
Attribute Meaning Description
onclick script The script will be executed when clicked
ondblclick script The script will be executed when you double click
onfocus script The script will be executed when focus is received
onmousedown script The script will be executed when the mouse button is pressed
onmousemove script The script will be executed when the mouse cursor moves
onmouseout script The script will be executed when the mouse cursor leaves the element
onmouseover script The script will be executed when the mouse cursor is over the element
onmouseup script The script will be executed when the mouse button is released
onkeydown script The script will be executed when a key is pressed
onkeypress script The script will be executed when a key is pressed and then released
onkeyup script The script will be executed when the key is released

Description

Displays the font as a subscript. The text is positioned below the baseline of the remaining characters in the line and is reduced in size.

Syntax

Text

Closing tag

Required.

Attributes

Similar to CSS

Example. Using a tag

Tag SUB

Under the influence of hydroxylamine, aldehydes are converted into oximes: CH 3 CHO + NH 2 OH=CH 3 C(=NOH)H + H 2 O

Specification ?

Specification

Each specification goes through several stages of approval.

  • Recommendation - The specification has been approved by the W3C and is recommended as a standard.
  • Candidate Recommendation ( Possible recommendation) - the group responsible for the standard is satisfied that it meets its goals, but requires help from the development community to implement the standard.
  • Proposed Recommendation Suggested Recommendation) - at this stage the document is submitted to the W3C Advisory Council for final approval.
  • Working Draft - A more mature version of a draft that has been discussed and amended for community review.
  • Editor's draft ( Editorial draft) - a draft version of the standard after changes were made by the project editors.
  • Draft ( Draft specification) - the first draft version of the standard.

The living HTML standard (Living) stands out - it does not adhere to traditional version numbering, since it is under constant development and is updated regularly.

Browsers: Desktop Mobile ?

Internet Explorer ChromeOperaSafariFirefox
2 1 3.5 1 1
AndroidFirefox MobileOpera MobileSafari Mobile
1 1 6 1

HTML Tags And - Subscript and Superscript Text

Definition and Use

Tag defines interlinear text. Interlinear text has half the height and appears below the baseline. Interlinear text can be used when writing chemical formulas, such as H 2 O.

Tag defines superscript text. Superscript text is half the height and appears above the baseline. Superscript text can be used when writing footnotes, such as WWW.

Browser support

Tags And supported by all major browsers.

Differences Between HTML and XHTML

Standard Attributes

Column DTD specifies in which document type the HTML 4.01/XHTML 1.0 DTD attribute is allowed. S=Strict, T=Transitional and F=Frameset.

Tags And support the following standard attributes:

Attribute Meaning Description DTD
class class_name Specifies the class name for the element STF
dir rtl
ltr
Specifies the text direction for content in an element STF
id identifier Specifies a unique identifier for an element STF
lang language_code Specifies the language code for the element's content STF
style style_definition Specifies an inline style for an element STF
title text Indicates Additional information about the element STF
xml:lang language_code Defines the language code for element content in XHTML documents STF

More information about Standard Attributes.

Event Attributes

Tags And support the following event attributes:

Attribute Meaning Description DTD
onclick script Script launched on mouse click STF
ondblclick script Double-click script STF
onmousedown script Script to run when mouse button is pressed STF
onmousemove script Script to run when the mouse pointer moves STF
onmouseout script Script to run when the mouse pointer moves outside of an element STF
onmouseover script Script run when the mouse pointer moves over an element STF
onmouseup script Script to run when mouse button is released STF
onkeydown script Script run on keypress STF
onkeypress script Script run when a key is pressed and then released STF
onkeyup script Script to run when the key is released STF

More information about

Computer