HTML syntax, HTML basic rules - Designing and developing web applications

HTML Syntax

The content of an HTML document consists of a set of items that are highlighted by opening and closing tags that are written in angle brackets (& lt; & gt;). With tags, the HTML document is divided into hierarchically nested parts. The description of the element has the following format:

Display a simple HTML page in a web browser

Fig. 1.6. Display a simple HTML page in a web browser

Basic HTML rules

The names of HTML tags are not case sensitive, and in XHTML small and large letters are considered different, and tag names must be written in small letters.

Elements can include text and sub-elements (as, for example, the html element contains the head and body sub-elements in the example above). Elements must be properly nested within each other.

The subelements included in an element must end before the closing element gag. For example, the following entry was erroneous: & lt; b & gt; & lt; a & gt; This is bold and inclined text & lt;/b & gt; & lt;/& gt;

Correctly this fragment should have the following appearance:

This is bold and italic text

In XHTML, if an element does not include text and subelements (an empty element), it should still have an opening and closing tag. For example, the element br has no content and causes a line break (the continuation of the text begins with a new line). However, in accordance with the rules, it should be written as follows:

or abbreviated

. Similarly, the & lt; hr/& gt; - output of the horizontal line.

Opening element tags can have attributes that specify the behavior of the element and specify additional values. Almost every tag has a large number of optional parameters. Next, only the main attributes of tags will be considered.

Many attributes in HTML are common to all elements, but some are specific to that element or elements. All of them have the form:

attribute_name = value

For example:

& lt; div id- mySection & gt;

& lt; h1 & gt; Hypertext Markup Language Fundamentals & lt;/h1 & gt;

& lt;/div & gt;

In this example, element div (HTML-page section, allowing to divide the documents into logical blocks) has attribute id set to a value mySection. Div element comprises an element h1 (first header, or the most important, level), which in turn contains some text. Attribute values ​​must be placed in single or double quotes.

The names of tags and attributes and their possible values ​​are determined by the HTML specification, and you can not create your own tags or attributes.

All elements can be specified with the id and class attributes, the values ​​of which are used to identify particular elements (id) or a group of elements (class). These attributes are actively used in document scripts and descriptions of CSS document styles.

There are two main categories of elements in HTML: block and string

Block elements usually inform about the structure of the document. Such elements begin with a new line, breaking away from what was before that. Examples of block elements are paragraphs , list items, headers and tables, div containers.

• String elements are contained within the structural elements of the block level and cover only parts of the document text, rather than entire regions. A string element does not result in a new line in the document, because they are elements that appear in the paragraph of the text. Examples of string elements are references, highlighted words or phrases, span containers.

thematic pictures

Also We Can Offer!

Ошибка в функции вывода объектов.