Language xhtml. Glossary of terms

XHTML is an XML-based hypertext markup language that is as close as possible to current HTML standards. XHTML differs from HTML in the strictness of coding. If HTML allowed you to write almost any construction and the browser recognized them correctly, now, with the advent of XHTML, this has become impossible. The latter requires strict compliance with all rules imposed by the W3C. Strict requirements for the design of XHTML code allow you to avoid many errors even at the stage of writing and debugging.

For HTML adherents, I would like to note that XHTML is a new language that replaced the old HTML. There will be no more new versions of HTML. Eventually all browsers are expected to move to XHTML (obviously maintaining compatibility with older HTML, but nothing more). We would also like to quote from the Russian translation of the XHTML specification from the W3C: “The XHTML family was created with the overall interoperability of user agents in mind. With the help of a new mechanism for profiling user agents and documents, servers, proxies and user agents will be able to transform content in the best possible way. Ultimately, it will be possible to develop XHTML-compliant content suitable for any XHTML-compliant user agent."

XHTML is compatible with HTML subject to certain rules, a description of which can be found in the standard. This means that even the oldest browsers that understand HTML will also work with XHTML.

To check the correctness of the XHTML code, there are validators. In addition, user agents that support XHTML will report syntax errors to you if they occur.

Differences between XHTML 1.0 and HTML. There are several requirements that the developer must fulfill:
  • one of the possible DTDs (Document Type Definition) must be indicated at the beginning of the document:
  • The body of the XHTML document must contain the following tags: html, head, title And body;
  • attribute must be present xmlns in element html;
  • tag and attribute names must be written in lowercase;
  • all attribute values ​​must be enclosed in quotation marks;
  • all tags must be closed; If an element does not have a closing tag, you should add a slash (
    or
    — space for compatibility with older browsers);
  • It is necessary to observe the correct nesting of tags ( text - incorrect; should be written text );
  • it is prohibited to use minimized attributes ( nowrap should be replaced by nowrap="nowrap"); full list of such attributes: checked, compact, declare, defer, disabled, ismap, noresize, noshade, nowrap, multiple, readonly, selected.
  • on the following elements restrictions are imposed on the inclusion of other elements in them:
    • a a;
    • form cannot contain other elements form;
    • label cannot contain other elements label;
    • pre cannot contain img, object, big, small, sub or sup;
    • button cannot contain elements input, select, textarea, label, button, form, fieldset, iframe or isindex;
  • special characters in true meaning must be replaced with their equivalents:
    • & on & ;
    • < on < ;
    • > on > .

In addition, there are a number of optional recommendations that the developer is not required to follow in version XHTML 1.0, but in subsequent versions of this language the recommendations may develop into requirements:

  • declaration of the XML document at the very beginning of the code before the DTD ( );
  • element following title immediately after opening the tag head;
  • attribute usage id instead of name(name is considered a deprecated attribute);
  • presence of the type attribute in elements of included files (style sheets and scripts);
  • refusal to use the attribute target.

Here is the minimum code for a correct XHTML page:

Title Document Contents

If you paste this code into a file, save it as "file.html" and open it through a web server, then all the information will be received by the client as >text/html*/-->

This syntax is universal. This code will work correctly for both .

The best and the most simple solution there will be a connection external files style sheets and scripts. In XHTML this is done in the same way as in HTML:

The development of HTML has, in a certain sense, reached a dead end - new tags are no longer needed, since the existing ones are sufficient, and besides, the emphasis in web page development has shifted to styles that expand the possibilities for document design. Naturally, CSS does not replace HTML in any way, but it allows you to use a limited set of tags, and the type of elements, their position and various parameters, set through styles.

A certain limitation of HTML is that it belongs to formal languages, in the sense that tags and their hierarchical structure are strictly described in the specification. Therefore, XML is gaining popularity, with which you can create your own tags and form their structure. The difference between HTML and XML is not only the tags, but also the rules for writing code. When working with HTML, the browser “turns a blind eye” to various minor flaws and shortcomings in the structure or to the fact that an attribute is not specified correctly. Such tricks do not work with XML, so the browser will generate an error stating that the document is not formed correctly.

To teach developers the "right" way of thinking, change their coding style, and bridge the gap between HTML and XML, XHTML was developed as an intermediate step between the two.

XHTML (EXtensible HyperText Markup Language) is intended to replace HTML and is considered its more strict version. In general, the W3C defines XHTML as latest version HTML, which will gradually replace it. Whether this will actually be the case, only time will tell.

If we think about some ideal web page code, it can be compared to a program that will not compile until all errors are corrected. The browser acts as a compiler and does not display the document if it does not meet the specification. XHTML, while retaining all the features of HTML, introduces more strict rules for creating pages in order to get closer to the “ideal” code. This allows you to make sites independent of the display device and browser. In other words, the site will be displayed correctly in all modern browsers and platforms such as computers, smartphones, PDAs, netbooks, etc.

In reality, everything is more mundane. Browser developers can't afford to make their brainchild work only with the "correct" code. And all due to the fact that most of the sites in the world simply will not be displayed in such a browser. Both developers and users are to blame for this state of affairs. The former did not provide proper support for the specification in their browsers, and the latter did not bother to follow it.

For these reasons, XHTML 1.x is just a semblance of HTML, but with a stricter syntax, and not a promising markup language that is definitely worth switching to because of its unique capabilities.

XHTML Stands for ExtensibleHypertext Markup Language and in Russian - Extensible Hypertext Markup Language. Please note that it is not extended, but expandable. This means that this language

It is still being replenished (expanded). So what is XHTML? The main difference between XHTML and HTML is the way the document (web page) is processed. It is worth introducing one more definition. Parser is a program or part of a program that performs parsing. It is also called a parser. To put it even simpler, then this program performs an analysis of the entire structure of the page, the entire page code. In HTML, when an error was found, it was corrected during analysis, which required additional time - the browser needed to understand what the author (developer) wanted to write. For example, if there was an error in any tag, it was simply displayed with the rest of the text.

Another difference is that all elements must be closed, and single tags must be followed by a /, for example:
. I will write a separate large article about tags, and I will also write about each tag separately. The encoding in XHTML is UTF-8 (the most common now), while in HTML ISO 8859-1 was used.

  • The first common mistake is to indicate in the tag the relative path to the DTD file copied from the site www.w3.org, "DTD/xhtml11.dtd". In place of this you need to write the full path "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" .
  • violation of the principle of closing all elements without exception. XHTML language, unlike the same HTML, obliges to close all elements, including those that do not have a closing tag, such as, for example,
    .
  • The absence of quotation marks when describing attribute values ​​is unacceptable. For example design
    Internet