Html 5 is not checked for correct syntax. The html syntax and the structure of the html document. Rules for writing HTML code

Date Created: 2012-03-04 00:50:20
Last edited: 2012-10-25 07:15:35

Modern life is almost impossible to imagine without the Internet. What would we do without all sorts of Odnoklassniki, Vkontakte and Live Journals? It's even scary to imagine how impoverished our life would be if HE suddenly disappeared! How would we live without funny pictures, stupid videos, megabytes of African spam? No, friends, I refuse to live in such a terrible world!

What is the Internet? (Internet)

The Internet is all computers (computing devices) in the world, interconnected.

A synonym for the Internet is web. The word web is tracing paper from the English web (cobweb). And the web, in turn, is part of the concept World wide Web (world wide web). A huge share of the Internet is occupied by all kinds of sites.

What are sites (Site)

A site is a number of text files in html format. Those. these are ordinary files that are stored on some computer.

And here we come to our topic: what kind of format is this - HTML, and why is it needed?

What is HTML?

HTML (HyperText Markup Language) is such a special language. But it should be noted right away that this is not a programming language. It is a text markup language.

HTML takes its history from special programs for marking newspaper articles. These programs allowed you to specify how to arrange the text on the page, where the pictures will be. HTML allows you to do the same, only on the screen digital device (computer, phone ...).

If you open any text file in notepad, you will only see boring text. HTML, on the other hand, allows you to turn such boring text into more interesting: add a picture somewhere, break the text into blocks somewhere.

Another distinctive feature of HTML is hypertext. Hypertext is links. Those. this is an opportunity to mark the text in a special way and clicking on this text will lead to a transition to another page. Those. hypertext (links) allows you to link together different pages (files, since every page on the Internet is a file).

Using HTML - markup syntax

HTML-text consists of tags in which information is placed.

A tag has two parts: a start tag and an end tag. Both the opening and closing tags contain the tag name. But in the closing, a forward slash is placed before the name / - to distinguish the closing from the opening. Here are some examples:

Tag content

Tag content
Tag content
Tag content

The word tag translates as - label, tag. Those. the tag is, as it were, attached to the content - marks it.

Each tag has its own meaning. What are the meanings of the tags we saw above? p - paragraph. a - link. div is a block. span - a piece of text. We'll look at the meanings of these tags in future tutorials.

Single tags

Some tags do not have an end pair. This means that such tags have no content. For example, the br tag - breaks the line:

Plain text,
For example
which shows a gap
lines.

Where the br tag is, the browser will make a line break. As a result end user the above sentence looks like this:

Plain text,
For example
which shows a gap
lines.

There are also tags that do not have a closing pair: hr (horizontal bar) and img (image).

Hierarchy of tags

Tags can be embedded within each other.

One more paragraph.

Here the div contains two paragraphs, and the first paragraph contains the link.

When creating a hierarchy of tags, the main thing is that they do not overlap:

You can not do it this way!!!

Here the p tag should be closed first, then the div.

Tag attributes

Attributes allow you to specify additional information. Attributes are written with a space after the name of the breakout text:

<тег атрибут1="Значение атрибута" атрибут2="Значение атрибута" атрибут3="Значение атрибута">Tag content

This is how it will look on the finished page:

Another example of an attribute is img's src. This attribute allows you to specify the path to the image that should be loaded:

Attribute values \u200b\u200bcan be written both in double quotes and in single quotes:

Both options are correct.

That's basically all. We are now ready to start creating HTML documents.

The Internet is worldwide networkbringing together computer networks all over the world on the basis of uniform standard agreements (protocols) on methods of information exchange unified system addressing.

By now, the Internet has received unprecedented distribution. According to experts, the Internet connects more than 100 million computers. More than 300 million people in 170 countries use the Internet.

From a functional point of view, the Internet is:

ü inexpensive high-speed communication tool between subscribers around the world;

ü unparalleled repository of information on any areas of knowledge;

ü a new and promising business environment.

The influence of the Internet extends not only to the technological area of \u200b\u200bcomputer communications, it also has a social orientation and permeates the entire society as the operational means of obtaining knowledge, e-commerce, become more widespread.

The most widespread and in demand today is such an Internet service asWWW (World Wide Web the World Wide Web). Information on the WWW is presented in the form of so-called hypertext (or, more broadly, hypermedia) documents, which can contain formatted text, graphics, audio and video fragments. The main feature of hypertext documents is the presence of active zones that are sensitive to mouse clicks. Text fragments can be active. , whole images and their parts; clicking on the active zone will load the associated (target) document with this zone.

To learn how to post materials on the Internet, you first need to get acquainted with the hypertext markup languageHtml (Hyper Text Markup Language)

Basics of HTML

Hypertext Markup Language hTML documents is a collection of commands called tags (from English tagHTML tags found in the text of the document are interpreted by the browser when the document is displayed.

Viewing HTML documents is carried out using programs browsers(from english browser), which render the document according to HTML markup and provide hyperlink navigation. The most common are browsersMicrosoftInternetExplorerby Microsoft Corporation and NetscapeNavigatorby Netscape Communications Corporation.

Since an HTML document is a text file, it can be prepared in a simple text editor, such as notepad ( Notepad), but it is very time consuming. More often they use specialized editors designed specifically for preparing HTML documents, which allow you to insert tags using toolbar buttons or menu commands, and set tag attributes in dialog boxes, eg, Macromedia Dreamweaver, MicrosoftFrontPage,HomeSiteand etc.

HTML document can be obtained by converting to HTML format, for example, from document format microsoft package Office. It should be noted that with such a transformation, the original hTML text- the document turns out to be extremely redundant and needs correction. It is much more efficient to use special HTML editors.

HTML tag syntax

An HTML tag is written in angle brackets (symbols) and consists of a name followed by a list of attributes (optional for most tags). The names and attributes are English words and abbreviations.

Tags can be conditionally divided into two groups:

Paired tags (also called containers) have two components: opening (initial) and closing (final); the closing component has the same name, but when writing a forward slash (the / ). Document text and other tags can be placed between the opening and closing components. The fragment of the document located between the opening and closing elements of the container tag is formatted by the browser according to the meaning of the tag, for example, the text between the tags and , will be displayed in bold (tag name - from English bold). Paired tags can be nested, but must not overlap.

Unpaired tags (also called autonomous) do not have a final component; when interpreted, an object is inserted into the displayed document. For example, the tag occurring in the body of an HTML document causes an insert graphic image from pict.gif file.

The attributes in the list are separated from each other by one or more spaces, either tabs, or newlines; the sequence in which the attributes are written is irrelevant. The vast majority of attributes are used as a pair attribute name \u003d attribute value... In the case when the attribute value is more than one word or one number, it should be enclosed in single or double quotes. Attributes are not specified in the closing tag components.


Here's an example of a tag with attributes:

Tag name Attribute name

Attribute value

Attribute name

Attribute value

Hello !

Upon encountering such a tag in an HTML document, the browser interprets it by displaying the text following the tag in characters increased relative to the base size (SIZE \u003d + 2) and red (COLOR \u003d RED); this text formatting is applied until an end tag is encountered.

The case of characters in the tag and attribute record is irrelevant.

HTML document structure

An HTML document is enclosed in the and tags. Between these tags there are two sections: the header section (between the and tags) and the document body section (between the and tags). The header section contains a description of the parameters used when displaying the document, but are not reflected directly in the browser window The body section of the document contains the main text intended for display by the browser, formatting tags, placement of figures, tables, hyperlinks, etc.

Html - the code of the simplest document suitable for posting on the Internet looks like this:

< TITLE > Our first page TITLE\u003e

The simplest HTML document

This code can be typed in the text editor Notepad and saved as a file with the extension.htm or. html - in this case, the document will open in the browser installed on your computer by default. The browser will display this document by displaying in its window the string "Simplest HTML Document" located in the body section of the document. The phrase "Our first page" will appear in the browser's title bar.

HEAD section

The header section usually contains tags that are invisible to the user, but nevertheless able to actively influence not appearance document.

Tag

Appointment

Specifies the name of the entire document. The name is usually displayed in the header of the browser window. This element is required for any HTML document and can be specified no more than once.

Specifies the base address of the current document (URL), which will be the starting point for calculating relative addresses within the document. The item has no end tag. The presence of at least one of the arguments is required:

Href - defines the base address (URL) of the current document.

TARGET - defines the name of the frame, which will be used in hyperlinks by default. This can be useful if you want to open all links in a document in a different frame.

< STYLE TYPE= "text / css ">

Used to insert Cascade Style Sheet (CSS) into a document. TYPE is a required attribute, the value of which is usually " text/css".

< МЕТА …>

The META element is used to technical description document. With the help of this element, additional useful information is introduced into the title of the document, which is invisible to the user, but sometimes simply irreplaceable for the correct indexing of your page by the robots of search engines. The element has no end tag.

NAME - defines the name of the meta record. There are many predefined names, some of which you can see in the example below.

CONTENT - assigns the value of the meta record specified in the NAME parameter.

BODY section

This section includes the main content of the web page - document text, images, tables, etc. The BODY element must appear at most once in a document and can include the following attributes:

Attribute syntax

Appointment

MARGINHEIGHT \u003d number

Specifies the width (in pixels) of the top and bottom margins of the document. Only works in Netscape browsers

TOPMARGIN \u003d number

Specifies the width (in pixels) of the top and bottom margins of the document. Only works in internet browsers Explorer

MARGINWIDTH \u003d number

Determines the width (in pixels) of the left and right margins of the document. Only works in Netscape browsers

LEFTMARGIN \u003d number

Determines the width (in pixels) of the left and right margins of the document. Only works in Internet Explorer browsers

BACKGROUND \u003d Url

Defines the image to "fill" the background (wallpaper). The value is set in the absolute or relative address of the image (see section Placing Pictures)

BGCOLOR \u003d colour

Specifies the background color of the document.

MicrosoftInternetExplorersupports 16 standard color names (aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, yellow, white)

Another way is to use a six-digit hexadecimal color code that specifies the intensity of the red (first two digits), green (next two digits), and blue (last two digits) components. The intensity of each component in hexadecimal form ranges from 00 to FF. When specifying a color as the value of an attribute of a tag, a # symbol is placed before the hexadecimal number.

For example, the entryCOLOR \u003d "# 0000 FF "means blue

Despite the fundamental ability to set millions of colors, it should be borne in mind that browsers display only 256 colors, and each browser has its own color palette. In this palette, the browser will select the color that is closest to the given one.

TEXT \u003d colour

Defines the color of text in a document

LINK \u003d colour

Specifies the color of hyperlinks in a document

ALINK \u003d colour

Specifies the highlight color of hyperlinks at the moment of clicking

VLINK

Determines the color of hyperlinks to already viewed documents

Text formatting

Formatting characters

All character formatting tags have both an opening and closing component and affect the text between them.

The main is the tag ... FONT\u003e, which must be used with one or more attributes that change the size, color, and typeface of a font:

Attribute syntax

Appointment

SIZE \u003d value

The size is specified either in the form of an absolute value (a number between 1 and 7) or relative to the size of the main font (in the form + n or -n).

COLOR \u003d colour

Colour

FACE \u003d font list

Typefaces for displaying text; names are listed in order of preference, separated by commas, for example,FACE \u003d "Verdana,Helvetica,Arial,Sans -Serif "

You can also specify one of the typefaces, but keep in mind that this font may not be installed on the user's computer, and "exotic" fonts will not be displayed by the browser

In addition, tags are used to change the style of characters:

. .. (from English bold) - bold;

.. ... (from English italic) - italic;

... (from English TeleType) - monospaced font;

... (from English underline) - underlined;

... S \u003e (from Englishs trikethrough) - crossed out;

... (from English sub script) - subscript;

... (from English sup erscript) - superscript.

Text enclosed between tags

and (from English pre formatted) is displayed as it was previously formatted, with all spaces and line breaks.

Formatting paragraphs

The text is displayed in the browser window word by word; when the right border of the window is reached, the next word is automatically wrapped to a new line. Even if several spaces were entered in the page code or the text was written with new line, when viewed in a browser, these actions will not be displayed. Therefore, in order to display a series of consecutive spaces or several blank lines in the text, you have to use various tags.

Tag
(from english b reak) breaks text stream and inserts a new line without creating a new paragraph. Several consecutive tags
are interpreted as several empty lines. Single line spacing. The tag has no closing component, as well as attributes.

Tag (from english p aragraph) begins a paragraph; a new paragraph is separated from the previous one by double line spacing. A paragraph cannot be empty, that is, several consecutive tags

are interpreted as one (as opposed to the
) .Closing component

is optional, since the previous paragraph ends where the new one begins. The tag has an optional ALIGN attribute indicating the type of paragraph alignment, which can be LEFT, CENTER, RIGHT andJUSTIFY , setting the alignment to the left, center, right and width, respectively. The text enclosed in tags will also be centered.

...

If the enclosing component

omit, then the specified alignment type is saved until the next tag specifying alignment, or until the end of the document.

HTML allows you to format paragraphs as numbered or bulleted lists. A piece of text that is a list is enclosed in tags:

ordered (numbered) list (from English o rderedl ist)

unordered (bulleted) list (from english u norderedl ist)

Each element of an ordered or unordered list is enclosed in tags ... (from English l isti tem). When displaying text, each element of the list will be positioned on a new line, indicated by a number or marker. In addition, the list can have a title, which is specified by the tag (from Englishl isth eader). End tags and are optional.

Numbered list

Bulleted list

Code item

< O L>

Heading

First element

Second element

Third element

< U L>

Heading

First element

Second element

Third element

U L\u003e

Browser display

Heading

1. First element

2. Second element

3. Third element

Heading

· First element

· Second element

· Third element

A multilevel list can be organized with a combination of numbered and bulleted lists.

The tag has optional attributes:

Attribute syntax

Appointment

TYPE \u003d format

the numbering format can be:

arabic numerals (default)

uppercase letters

lower case

large roman numerals

small roman numerals

START \u003d value

first number in the list (default 1)

Tag has an optional attribute

Attribute syntax

Appointment

TYPE \u003d format

the format of the marker can mean:

Disc

disk (default)

Circle

circle

Square

Square

Paragraphs can also be formatted as headings of the level (fromn \u003d 1 to n \u003d 6), for this use tags of the form n \u003e ... n >. The first level heading is displayed in the largest font.

Tags

, ... ,

can have an alignment attribute ALIGN with values \u200b\u200bLEFT, RIGHT, and CENTER.

Placing Pictures

The images that are displayed by the browser when viewing the web page are stored in separate files formatgif, jpg (jpeg) or png , and the page code refers to desired file... To do this, use an unpaired tag that has one required and a number of optional attributes ..

Required attribute:

SRC \u003d url

Address graphic file (relative or absolute)

ALT \u003d text

Alternative text displayed in browser mode without loading images (must be enclosed in quotes)

BORDER \u003d value

Border width in pixels, 0 means no border (default)

BORDERCOLOR \u003d colour

Specifies the color of the border

HEIGHT \u003d value

Image height in pixels (original by default) or as a percentage of the browser window height

WIDTH \u003d value

Image width in pixels (original by default) or as a percentage of the browser window width

HSPACE \u003d value

Free space to the left and right of the image in pixels

VSPACE \u003d value

Free space above and below the image in pixels

ALIGN \u003d value

Horizontal alignment of the image.

If values \u200b\u200bare givenLEFT or RIGHT , the image will be appropriately aligned horizontally, setting these values \u200b\u200bensures that text flows around the image

Let's take a closer look at the absolute and relative ways of addressing the file.

Addressing in absolute form used when referring to resources located on other servers. The universal address that determines the location of an information resource is called Url(Uniform Resource Locator). A URL has two parts, separated by a colon. The first part indicates the type of network protocol, which depends on the type of resource. For example, if the resource is located on a WWW server, this is the protocol http.The second part includes the name of the computer (server) in domain system names and (if required) the pathname of the file. When recording the path name, the directory names are separated by a forward slash (symbol / ), in file and directory names distinguish between uppercase and lowercase letters, spaces are not allowed. Here are examples of URLs:

http: // www. vshu. kirov .ru / site / images / picture 1.jpg

http://195.21.123.13:8110

ftp://everything.com/soft/prog.zip

mailto: This email address is being protected from spambots. You need JavaScript enabled to view it.

Last URL pointing to the protocol mailtoand address email, does not refer to any information resource; this is the only URL type that does not include two forward slashes after the colon.

Addressing pictures in absolute form is practically not used when creating a website.

Relative addressing used when linking to resources located on the same server. When writing the path to the file, the directory names are separated by a forward slash (symbol / ), navigating through directories file system one level up is indicated by two dots (symbols .. ). To make it clearer, imagine a computer, for example, with the following directory structure containing HTML files:

SHAPE \\ * MERGEFORMAT

MySite

Pages

Ima ges

Page1.htm

Page2.htm

Pict1.jpg

Pict2.jpg

Index.htm

Picture.jpg

In this case, for example, such options for recording a tag are possibleIMG:

ü < IMG SRC = Picture . jpg > (Image Picture.jpg located on the pageIndex. htm)

ü < IMG SRC = Images / Pict 1. jpg > (Pict image 1.jpg located on the pageIndex. htm)

ü < IMG SRC =../ Picture . jpg > (Image Picture.jpg located on the pagePage 1. htm)

ü < IMG SRC =../ Images / Pict 1. jpg > (Pict image 1.jpg located on the pagePage 1. htm)

Despite the fact that only the SRC attribute is formally required, in practice it is necessary to specify alternative text (ALT attribute), since many work with the browser in the mode without loading images.

The height and width of the area in which the picture is displayed is set using the width and height attributes in pixels or as a percentage of the screen size. In the case when one of these attributes is set, the picture is scaled so that its height or width matches the specified one. The second dimension is set automatically, in the appropriate proportion. Applying only one of the attributes changes both dimensions of the picture.
If both attributes are set explicitly, then the picture will be scaled along two axes in accordance with the specified dimensions. The height and width attributes do not change the image loading time, but only its appearance (size) on the screen.

Hyperlinks

A hyperlink is an object (text, image, fragment of an image), when you click on it, you go to a new document or a fragment of a document. It is hyperlinks that make it possible to organize transitions between any documents posted on the Internet.

Text hyperlinks

The link between HTML documents and document fragments is organized using the tag ... (from english anchor - anchor).

The tag is used both to create a link to another document, and to link to a fragment of a document.

Required attribute:

HREF \u003d url

Address of the target document (can be presented in absolute and relative form)

Basic optional attributes:

NAME \u003d " name"

Marks in between< A\u003e and A \u003e a fragment of a document as a possible object for a link. As a value you need in Latin write any index word that is unique to this document. For example, the tag Section 1 creates a so-called label (bookmark) to go to section 1 . In this case, you can refer to the tagged area by simply specifying its name after the document name (preceded by a #).

So, < AHREF \u003d "Index.html #part 1 "\u003e To section 1A\u003e will send you to the "part 1 "of the Index.html file, and
< AHREF \u003d "#part 2 "\u003e To section 2A\u003e - to the section "part 2 "of the current document, provided that the document has a corresponding label

TARGET \u003d " name"

The name of the frame (frame) or window to display the target document.

This attribute is used only in conjunction with the HREF parameter. The value must be either the name of one of the existing frames or one of the following reserved names:

_self - indicates that the document specified in the HREF parameter should be displayed in the current frame;
_parent - indicates that the document should be displayed in the parent frame of the current frame (occupy the entire browser window);

_blank - indicates that the document should be displayed in a new window

TITLE \u003d "(! LANG: text!}"

Displays a tooltip when you hover over a hyperlink

Text and images placed between tags become the active area of \u200b\u200bthe document, sensitive to mouse clicks, which causes the target document to load. Hyperlink text is underlined and colors specified as the value of the LINK attributes,A LINK, V LINK tag (either in default color).

Hyperlink images

To make a whole image a hyperlink, the tag is also applied ... ., only instead of text (or with text) between < A\u003e and A\u003e the tag is located< IMG …\u003e With all relevant attributes.

For instance , .

Hyperlink map

The tag allows you to make a text fragment or image a hot spot wholly; for the same to different fragments the same image was linked to different target documents, you will have to use a tag that implements the image-map.

For a container tag, the only required attribute is NAMEwhose value is the name (for example, NAME \u003d " mymap "to be used when describing an attribute USEMAP an IMG tag describing an image intended to serve as a map (with # - USEMAP \u003d "# mymap ")

Within the container, each area of \u200b\u200bthe image that is sensitive to mouse movement must have a tag with attributes:

Attribute syntax

Appointment

COORDS \u003d list

Comma-separated list of the coordinates of the core (depends on the type of the specified zone shape)

HREF \u003d url

SHAPE \u003d the form

Defines the shape of the core. Possible values \u200b\u200bfor this attribute:

circle (circle - set by center coordinates and radius in pixels);

rect (rectangle - set by the coordinates of the upper left and lower right corners);

poly (polygon - set by the coordinates of its vertices)

Coordinates in all cases are measured from the upper left corner of the image in pixels, the X axis is directed to the right, theY - down.

NOREF

sometimes it is necessary to indicate that this zone (specified by the SHAPE attribute and COORDS coordinates) is not active, there is no reaction to a mouse click

Tables

Tables in HTML documents are used not so much to arrange data in framed cells, but to arrange pieces of text and images in relation to each other.

HTML tables are built line by line. All tabular data are wrapped in tags

; the description of each row of cells (lines) is contained in tags ... ; the contents of each cell are enclosed in tags ... (regular cells) or H\u003e ...H\u003e (headers) .

Thus, to describe, for example, a table with two rows, each of which contains two cells, you will have to create the following construction:

Table cells can contain text, images, nested tables, etc. Do not leave table cells blank; if a cell should appear blank, put a non-breaking space in it.

Text placed in table cells is automatically placed by the browser by default; the text is displayed word by word; when the right cell border is reached, the next word is wrapped on a new line.

Table cells can span multiple rows or columns and are described using the ROWSPAN attributes (the cell tagged with this attribute is "stretched" the specified number of rows) and COLSPAN (the cell "stretched" over several columns). Here is an example of organizing a table with merged cells:

< TR >

< TD ROWSPAN=2> 1-1 TD\u003e

Tags describing tables have whole line optional attributes.

The tag attributes define the parameters of the table as a whole:

Attribute syntax

Appointment

ALIGN \u003d value

Alignment with respect to the text stream; possible values \u200b\u200bare left, right and center

BACKGROUND \u003d url

Background image for the entire table

BGCOLOR \u003d Colour

Background color

BORDERCOLOR \u003d colour

Border color

BORDERCOLORDARK \u003d colour

Colors the right and bottom edges of the main frame and the left and top edges of each cell with the specified color

BORDERCOLORLIGHT \u003d colour

Colors the left and top edges of the main frame and the right and bottom edges of each cell in the specified color

CELLPADDING \u003d value

Distance from cell borders to its content in pixels

CELLSPACING \u003d value

Distance between cells in pixels

HSPACE \u003d value

Free space to the left and right of the table in pixels

VSPACE \u003d value

Free space above and below the table in pixels

WIDTH \u003d value

Table width (set in pixels or as a percentage of the current browser window width)

Tag attributes are parameters this series (if there is a conflict, the attributes specified in the tag are canceled).Alignment of cell contents; possible values \u200b\u200bare left, right and center

BACKGROUND \u003d url

The background image for the cells of the given row of the table

BGCOLOR \u003d Colour

The background color for the cells of this row

BORDER \u003d value

The thickness of the border that surrounds the cells of this row; BORDER \u003d 0 indicates an invisible border

VALIGN \u003d value

Vertical alignment of cell contents; possible values \u200b\u200bare top, center and bottom

The attributes of the tag set the parameters of this cell (if there is a conflict, the attributes specified in the tags and are canceled).

Attribute syntax

Appointment

ALIGN \u003d value

Cell alignment; possible values \u200b\u200bare left, right and center

BACKGROUND \u003d ur l

Background image for a table cell

BGCOLOR \u003d Colour

Background color for a cell

BORDER \u003d value

The thickness of the frame that frames the cell

VALIGN \u003d value

Vertical alignment of the cell contents; possible values \u200b\u200bare top, center, and bottom

WIDTH \u003d value

Cell width in pixels or as a percentage of the table width

ROWSPAN \u003d value

Indicates the number of rows covered by the cell

COLSPAN \u003d value

Specifies the number of columns the cell spans

When working with tables, keep in mind that the specified value for the WIDTH attribute is in many cases only "taken into account" by the browser. The specified proportions are rarely kept exactly, the browser tries to display the table as best as possible (in its understanding).

Ticker

Using a scrolling line on a web page makes it more dynamic, allows you to create the effect of object movement. A creeping line is created using the tag< MARQUEE> … MARQUEE>.

Between< MARQUEE\u003e and MARQUEE\u003e text fragments and pictures can be located. The text can be formatted with the appropriate tags, and the picture is inserted using.

Attribute syntax

Appointment

BGCOLOR=colour

Background color. If the background is set, the browser draws a colored strip on the screen along which text or a picture moves.

HEIGHT= value

The height of the background bar. The value is specified in pixels or as a percentage of the height of the browser window.

For example, if you specify the attribute HEIGHT \u003d 25%, then the crawl bar will occupy a quarter of the window height

WIDTH \u003dvalue

Creeping line width, specified in pixels or as a percentage of the browser window width

DIRECTION \u003d value

Line movement direction:left - to the left (by default),right - to the right,up - up,down - down

BEHAVIOR= value

The attribute controls the behavior of the scrolling line:

scroll (by default) - when it reaches the edge of the window, the line leaves the field of view, and then appears from the opposite side;

slide - the line appears from behind the edge of the window, reaches the opposite one and stops;

alternate - the line moves to the right or left, "reflecting" from the edges of the window and changing the direction of movement

HSPACE = pixel offset

Shift the creeping line horizontally to the right

VSPACE = you cot a in pixels

Create white space above and below the strip

LOOP= value

Number of line transitions across the screen

SCROOLAMOUNT= value

The number of pixels the line traverses in each step. The default mode is approximately 10 pixels / step. This attribute allows you to adjust the speed of the line

SCROLLDELAY \u003d value

Defines the time interval (in milliseconds) between steps, using this attribute you can make the line move in jerks

TRUESPEED

Setting this flag (attribute with no value) will use the specified SCROLLDELAY value. If the flag is not set the value SCROLLDELAY<= 59 будет округлено до 60

Horizontal line

The horizontal line is set by the tag R\u003e and does not require an end tag. By default, a line is drawn across the entire width of the page and looks something like this:

Specifies the length of the line in pixels or as a percentage of the width of the browser window

SIZE= value

Specifies the width of the line in pixels

ALIGN= value

Determines the alignment of the horizontal line. The parameter can take the following values:

left - left-aligned,

right - on the right edge,

center - centered (used by default)

NOSHADE

Specifies how the line is drawn as solid. The parameter is a flag and does not require a value to be specified. Without this parameter, the line is displayed in volume

COLOR \u003d colour

Specifies the color of the line (valid only inInternetExplorer)

Html stands for HyperText Markup Language ( hypertext markup language):

  • language means that it can be read by both humans and computers;
  • markup means that the code you write is tagged with keywords;
  • hypertext means it uses HTTP as part of the Internet.

Like any language, HTML comes with a set rules... These rules are relatively simple and boil down to determining bordersto know where something starts and where it ends.

Below is an example of a paragraph in HTML:

If Tetris taught me anything, it is that mistakes accumulate and achievements disappear.

What you see in angle brackets< и > called tags HTML. They determine where something starts and where it ends.

Each of the tags carries a certain meaning... In our case<р> denotes paragraph text.

As a rule, they come in pairs:

  • opening tag<р> defines the beginning of a paragraph;
  • end tag

    defines its end.

The only difference between start and end tags is the slash /, which precedes the tag name.

When you combine the opening, closing tags, and everything in between, you get hTML element... The entire string is an HTML element that uses hTML tags <р> and

.

If you view this example in your browser, you will notice that hTML tags are not displayed in the browser... They are only read by the browser to know what type content you wrote.

Where to write HTML

You've probably come across simple text files, those with the extension .txt. For such a text file to become HTML document (instead of text) you need to use the .html extension.

Open up text editor, copy and paste the following content:

This is my first web page!

Save this file as my-first-webpage.html, just open it with your browser and you will see:

This is my first web page!

  • use a text editor like Notepad ++ to creation HTML documents;
  • use a browser like Firefox to discoveries HTML documents.

Attributes

Attributes act like additional information bound to the HTML element. They are written inside an HTML tag. Thus, they are also not displayed in the browser.

For example, the href attribute is used to define the purpose of a link (which is created by the tag ):

Download Firefox

There are 16 HTML attributes that can be used on any HTML element. All of them are optional.

You will mainly be using class (which is used for CSS) and title (the tooltip that appears when you hover over an object like this).

Some hTML elements contain obligatory attributes. For example, when inserting an image, you must specify its location using the src attribute:

Whereas the purpose of the element is is to display the image, then it makes sense to make the path to the image compulsory.

Comments

If you write something in your code without breaking the display of the page by the browser, then you can write comments... They will be ignored by the browser and can only be used by people who write code.

Comment starts with .

Hello World!

Self-closing elements

Some HTML elements only have an opening tag:


Since they do not have an end tag and therefore cannot contain anything inside, self-closing elements usually carry multiple attributes with them that provide additional information.

Html stands for HyperText Markup Language ( hypertext markup language):

  • language means that it can be read by both humans and computers;
  • markup means that the code you write is tagged with keywords;
  • hypertext means it uses HTTP as part of the Internet.

Like any language, HTML comes with a set rules... These rules are relatively simple and boil down to determining bordersto know where something starts and where it ends.

Below is an example of a paragraph in HTML:

<p\u003e Today I am learning HTML syntax on site site</ p>

What you see in angle brackets< и > called tags HTML. They determine where something starts and where it ends.

I have already created an HTML reference entry that contains a complete list of all tags and their meanings. Link to this entry

Each of the tags carries a certain meaning... In our case<р> denotes paragraph text.

As a rule, they come in pairs:

  • opening tag<р> defines the beginning of a paragraph;
  • end tag

    defines its end.

The only difference between start and end tags is the slash /, which precedes the tag name.

When you combine the opening, closing tags, and everything in between, you get hTML element.

If you view this example in your browser, you will notice that hTML tags are not displayed in the browser... They are only read by the browser to know what type content you wrote.

Tag groups

All tags are divided into 2 types, inline and block.

Blocky elements like:

  • paragraphs<р> ;
  • lists: unordered (with bullet)
      or ordered lists (with numbers)
        ;
      1. headings: from the first level

        to the sixth level

        ;
      2. articles
        ;
      3. sections
        ;
      4. long quotes
        .

    Lowercase elements like:

    Blocky elements are for structuring the main parts of your page, by dividing content into logically related blocks.

    Lowercase elements are intended to delimit a part of the text and give it specific function or meaning. Inline elements usually contain one or more words.

    Attributes

    Tags can also contain attributes - special commands that extend the action of the tag. For some tags, they are required to work correctly. For example, in order for the link to lead to the specified address, you need to add an additional attribute. The link will look like this:

    Attributes are placed inside the opening tag in this format: <тег атрибут1=”значение” атрибут2=”значение”> .

    Quotes can be any - single or double, it is permissible not to put them at all if the attribute value consists of one word (but this is not desirable).

    Where to write HTML

    You've probably come across simple text files, those with the extension .txt. For such a text file to become HTML document (instead of text) you need to use the .html extension.

    Basically, to work with HTML, you can even use the usual text Documentwhich is standard on every computer. For this you need to create new document, write the code into it and save it in the .html format.

    To work with HTML files it was convenient, you can use a special editor that is designed to work with this type of file. One of such editors is Sublime Text 3, I already wrote about it from my previous posts. Here is the link to the entry -

    What to write in the file

    In order to visually view your site in a browser, you need to write the following code in the site file.

    This is the basic template used to write web pages with using HTML... Let's take a closer look at it.

    • - this is the code that tells the browser what we are using latest version HTML - HTML5
    • - inside this tag are all tags that are responsible for the functionality of the site. Here we connect third party files, include scripts, specify encodings and much more
    • body - inside this tag there are tags that will be displayed and the work of which we can see visually.

    Let's try to visually view the work of the code, display the text:

    My first site

    This is my first site!

    How could you replace each of these tags with a closing tag that we talked about earlier. The entire structure of the HTML code resembles a "matryoshka". One tag is nested inside another.

    This system has a special hierarchy. In this system, tags are divided into sibling, parent, and ancestor tags. Everything is relative here, each tag will have its own ancestors, parents and brothers.

    Parent name the tag within which the tag in question is located.

    Ancestors are called, tags that are located inside the tag in question.

    Fraternal names tags that are at the same level as the tag in question.

    This relationship is easy to understand from this example:

    <article> <h1\u003e Famous football quotes</ h1> <p\u003e Sir<strong\u003e Alex Ferguson</ strong\u003e once said about Filippo Inzaghi:<q\u003e This guy should have been born offside</ q> . </ p> <p\u003e When criticized by John Carew,<strong\u003e Zlatan Ibrahimovic</ strong\u003e answered:<q\u003e What Carew does with a ball, I can do with an orange.</ q> </ p> <p> <strong\u003e George Best</ strong\u003e said:<q\u003e I spent a lot of money on booze, girls and fast cars. I just squandered the rest</ q\u003e, - when asked about his lifestyle.</ p> </ article>

    In this structure:

    • is an ancestor for any other element;
    • is an parent for

      and three<р> ;

    • and three<р> are fraternal for each other;

    • each<р> is an parent for and that they contain;
    • each

      ,

      , and - it's all descendants

      .

    The family tree analogy also applies when traversing multiple layers of attachments in HTML:

    • descendant element X is any element inside X;
    • child - it's simple straight descendant;
    • ancestor element Y is any element;
    • parent - this is only the first straight ancestor.

    Here's what we learned from this tutorial

    1. We learned that HTML contains tags that store information and display it on site pages. Each of the tags carries a certain meaning.
    2. That for working with HTML files with the .html resolution are used. In order to work with HTML, you need to create a new document, write the code into it and save it in the .html format.
    3. The fact that HTML has a special hierarchy. Tags are divided into sibling, parent, and ancestor tags. Everything is relative here, each tag will have its own ancestors, parents and brothers.

    We start learning the language. HTML text is "plain text". All hypertext features of the document are set using tags - special marks included in this text.

    Let's have the text:

    Let's rewrite this text in a different way by inserting instructions on how to display the text. We mark the instructions with angle brackets.

    In HTML, hints are called tags. The browser follows the instructions-tags, that is, without showing them, it changes the text. Therefore, we will see the following on the screen:

    “Mom washed the frame, and the cat played with the ball. The boy took the ball from the cat. "

    Tag is a command in angle brackets. The tag name is the first thing written after the opening angle bracket, without any spaces before it! There are single tags and container tags. Single tags - some command to the browser, executed in the place where, for example, the command "draw a line" is indicated:

    Container tags consist of an opening tag and a closing tag, and their indication refers to all the text between them, they say: "nested in the container". The closing tag has the same name as the opening tag, but the name is preceded by a slash: "/":

    Mom washed the frame.

    .

    The tag can have attributes. The attribute complements and clarifies the tag. The order of the attributes is not important. For example, an HR tag has a WIDTH attribute for line width, SIZE for line width, ALIGN for position (alignment), and COLOR for color. Attribute values \u200b\u200bconcretize a given characteristic. The syntax rule is as follows: after a tag name, at least one space can follow, then, separated by spaces, triplets can follow: attribute, symbol "\u003d", value. It is recommended to enclose the value in quotation marks, although hTML standard allows values \u200b\u200bconsisting only of Latin letters and numbers not to be enclosed in quotation marks.


    The screen will look like this.

    _____________________________________

    The standard allows not to write the end tag, if it is implied. For example, the tag

    Has a closing one, but you don't have to write it before opening the next paragraph. Tag

    Indicates a paragraph.

    Mom washed the frame.

    My daughter was playing with a ball.

    Some attributes have no values, more precisely, they have a single meaning, and therefore it is enough to simply indicate or not indicate this attribute in the tag. For example, the FRAME tag has a NORESIZE attribute to indicate that the user is not allowed to resize this frame.

    Tags (elements) in HTML can be nested in a similar way to loops or conditional operators in programming languages. Crossing tags without nesting are prohibited.

    An example of an erroneous entry:

    block example

    with a nested paragraph

    An example of a correct entry:

    block example

    With a nested paragraph

    In addition to tags and plain text so-called character objects or Escape sequences can be encountered in HTML-code: named and numbered entities. They are needed to represent characters in the document that are prohibited syntactically or physically, as well as characters that cannot be entered from the keyboard. For instance,

    The case of the tag names and attribute names and values \u200b\u200bis not important. Although it is recommended to follow some style, for example, write the names of all tags in capital letters, either small or small, but with the first capital letter. Such text is easier for humans to perceive.

    A very important note! The purpose of the browser is to show the client your page. The usual reaction of the browser to an error is to try to correct the error, and if it fails, then skip words or tags that it does not understand. This is both good and bad. Since, on the one hand, as a result, the browser will try to show the user as much text as possible, but, on the other hand, a part with tags and scripts may get into this text or the text itself may not get there, if the browser perceives it, for example, as a comment. This browser behavior is very annoying for the site developer. Be prepared for the fact that at first the browser will diligently correct your mistakes, but after a while it will get confused and the previously working fragments will stop working for you. Therefore, a tip: don't make mistakes, but rather use modern editors that are aware of html rules and point out errors to you.