HTML span tag description: what is it, how to use it, features

Presenting information through the modern idea of ​​hypertext is absurd in essence, but it does and it works. You can not argue with this and have to be reckoned with.

From the point of view of a modern programming language, it does not matter how the data is presented: strict types and a mandatory preliminary description or there are no types and the language will “think through” the desired description as the algorithm runs.

It is important to note: everything that is "not understood" by the browser, JavaScript or server language will not be executed. Under the circumstances, a block tag can “turn” into a lowercase tag, but a lowercase tag into a block tag - no.

HTML page logic

A historical example is the HTML font tag. For a long time, it is "not recommended" for use. The “not recommended” motivation is a characteristic feature of modern programming. Lack of compatibility of the code "up" "by version and no stability in the consistent development of versions of software components and concepts, too.

Modern programming

Indeed, the span tag in HTML is much more practical: it does not apply only to the font. Span can change many attributes of display and use of specific content.

Strings have always been the main representation for any data, but programming languages ​​did not always define this with syntax, and programmers were aware that the number or logical value used was always a string.

The absurdity and objectivity of hypertext in the implementation of HTML: layout is the use of a set of tags (paired or single) for a formal description of content (data). Neither the description nor the content can reasonably be called information. The first is a certain framework in which some content - data, is stacked.

The frame is built of rigidly fixed bricks (tags), which occupy strictly defined places in the structure, and relative elements, which are located "as the card will lie down."

Hard frame and speaker

You can split the page into sections for displaying data with tables or block elements, and you can “fill in” the resulting structure with data with other tags. Usually they are called lowercase, that is, arranged as defined by the current feature and current content.

HTML span example: what it is and how to describe it

The green frame shows an example of the code that the browser displayed on a gray background. The block div is at the center of the text that comes after it in the code. The first element was a tag with the scSpanLine class. Then the text was placed, in which the span tag with the scSimpleSpan class highlighted two sections of this text.

The second and third line elements are located exactly as they are written in the code.

Span tag example

This example shows how span works in HTML. That this is just a sequence of data is obvious. Another thing is not obvious: the developer can describe this tag as he wants, he can even apply the rule:

  • POSITION: absolute;

There will be no effect. Indication of coordinates and sizes also does not play any role. To center or align span in HTML is futile. Meanwhile, the tag is very practical and in demand in practice. This is a very convenient wrapper to highlight an important point in the overall data stream.

The main thing is to understand that span HTML is a way to change the display of a string or clarify the rules for displaying part of a string.

The logic of providing line information

Use the HTML data description language for its intended purpose, that is, to describe the data, yesterday. To use the server language to form the body of the page is modern and so does “all” developers. This is especially true for site management systems (CMS).

The real practice and the need to create live sites is the dynamic management of the page frame and its content. In this sense, the span tag in HTML (which is just dynamics), as a result of JavaScript, allows you to create dynamic content on the fly.

JavaScript works as a converter of source text into formatted text and substitutes the necessary tags with the necessary CSS rules into the outgoing stream, which is distributed across the frame of the page block elements.

Block and line layout

The higher the professionalism of the developer, the more block (or tabular) markup of the page and the less the real presence of static span tags in HTML. What does it give? The dynamics. JavaScript is an algorithm that can do work on an incoming stream of strings and display it as the developer intended. Span tags will appear in the right place at the right time.

Source: https://habr.com/ru/post/C9333/


All Articles