We add images to the WEB page, as well as video and audio! Images in HTML Which tag adds an image to an HTML document.

HTML tags are the basis of the HTML language. Tags are used to delimit the beginning and end of elements in markup.

Each HTML document consists of a tree of HTML elements and text. Each HTML element is identified by a start (opening) and ending (closing) tag. The opening and closing tags contain the name of the tag.

All HTML elements are divided into five types:

  • empty elements - , ,
    , , , , , , , , , , , , ;
  • elements with unformatted text - , ;
  • elements that display unformatted text - , ;
  • elements from another namespace - MathML and SVG;
  • ordinary elements - all other elements.

The table shows full list elements supported by HTML4 and HTML5. Experimental and legacy tags are excluded. Elements added to the HTML5 specification are highlighted in teal.

Complete list of HTML elements Table 1. HTML elements Tag Description
Used to add comments.
Declares the document type and provides basic information to the browser - its language and version.
Creates hypertext links.
Identifies text as an abbreviation or acronym. Explanatory text is specified using the title attribute.
Specifies the contact information of the author/owner of the document or article. Displayed in italics in the browser.
It is a hyperlink with text corresponding to a specific area on an image map or an active area within an image map. Always nested inside a tag.
A section of content that forms an independent part of a document or website, such as a magazine article, blog post, comment.
Represents page content that is indirectly related to the main content of the page/site.
Loads audio content into a web page.
Sets a passage of text to be bold without adding emphasis or importance to the highlighted text.
Specifies the base address (URL) from which all relative addresses are calculated. This will help avoid problems when moving the page to another location, since all links will work as before.
Isolates a passage of text written in a language in which the text is read from right to left from the rest of the text.
Displays text in the direction specified by the dir attribute, overriding the current text direction.
Highlights text as a quote, used to describe large quotes.
Represents the body of the document (content that is not part of the document's metadata).

Wrap text to a new line.
Creates an interactive button. You can place content inside the tag - text or image.
Canvas container for dynamically displaying images such as simple images, charts, graphs, etc. The JavaScript scripting language is used for drawing.
Adds a caption to the table. Inserted immediately after the tag . creates a new line. Further in nested
Used to indicate the source of a citation. Displayed in italics.
Represents a piece of program code, displayed in a monospace font family.
Selects one or more table columns for formatting that do not contain the same type of information.
Creates a structural group of columns that identifies many logically homogeneous cells.
The element is used to associate the value of the value attribute, which is in a machine-readable format and can be processed by a computer, with the content of the tag.
Container element for a drop-down list element. Variant values ​​are placed in elements.
Used to describe a term from a tag.
Marks text as deleted by striking it out.
Creates an interactive widget that the user can open or close. Represents a container for content, the visible title of the widget is placed in the tag.
Identifies a word as a term by putting it in italics. The text that follows should contain a definition of this term.
An interactive element with which the user interacts to complete a task, such as a dialog box, inspector, or window. Without the open attribute, it is not visible to the user.
A container tag for sections of an HTML document. Used to group block elements for formatting with styles.
A container tag containing a term and its description.
Used to specify a term.
Highlights important passages of text by displaying them in italics.
A container tag for embedding external interactive content or a plugin.
Groups related elements in a form by drawing a box around them.
Title/caption for the element.
A self-contained container tag for content such as illustrations, diagrams, photographs, code examples, usually with a caption.
Defines the ending area (footer) of a document or section.
A form for collecting and sending information from users to the server. Doesn't work without the action attribute.
Create six levels of headings for related sections.
A container element for HTML document metadata, such as , , , , .
Section for introductory information of a site or a group of navigation links. May contain one or more headings, logo, information about the author.
A horizontal line for thematic division of paragraphs.
The root element of an HTML document. Tells the browser that this is an HTML document. It is a container for all other html elements.
Italics a passage of text without giving it additional emphasis.
Creates an inline frame by loading another document into the current HTML document.
Embeds images in an HTML document using the src attribute, whose value is the URL of the embedded image.
Creates rich form fields in which the user can enter data.
Highlights text with underlining. Used to highlight changes made to a document.
Selects text to be entered by the user using the keyboard in a monospace font.
Used to store additional information about the page. This information is used by browsers to process the page, and by search engines to index it. There can be several tags in a block, since depending on the attributes used they carry different information.
Indicator of measurement in a given range.
A section of a document containing navigation links for the site.
Defines a section that does not support scripting.
Container for embedding multimedia (e.g. audio, video, Java applets, ActiveX, PDF and Flash). You can also insert another web page into the current HTML document. The tag is used to pass the parameters of the plugin.
Ordered numbered list. Numbering can be numeric or alphabetical.
A container with a title for a group of elements.
Specifies an option/option to select from the , or , drop-down list.
Field for displaying the result of a calculation calculated using the script.

Paragraphs in the text.
Defines parameters for plugins embedded using the element.
A container element containing one element and zero or more elements. By itself it does not display anything. Allows the browser to select the most appropriate image.
Outputs text without formatting, preserving spaces and text breaks. Can be used to display computer code, email messages, etc.
An indicator of the completion of a task of any kind.
Defines a short quotation.
Container for East Asian symbols and their decoding.
Defines its nested text as the base component of the annotation.
Adds a brief description above or below the characters contained in the element, displayed in a smaller font.
Marks embedded text as additional annotation.
Displays alternative text if the browser does not support the element.
Displays text that is not current with a strikethrough.
Used to display text representing the result of program code or script execution, as well as system messages. Displayed in monospace font.
Used to define a client-side script (usually JavaScript). Contains either script text or points to an external script file using the src attribute.
Defines a logical area (section) of a page, usually with a header.
A control element that allows you to select values ​​from a proposed set. Variant values ​​are placed in .
Displays text in a smaller font size.
Specifies the location and type of alternative media resources for the , , .
Container for inline elements. Can be used to format passages of text, such as highlighting individual words with color.
Places emphasis in the text, highlighting it in bold.
Includes embeddable style sheets.
Specifies subscript writing of symbols, for example, element index in chemical formulas.
Creates a visible title for the tag. Displayed with a filled triangle, clicking on it allows you to view the title details.
Specifies the superscript spelling of characters.
Tag for creating a table.
Defines the body of the table.
Creates a table cell.
Used to declare HTML code fragments that can be cloned and inserted into a document by a script. The content of a tag is not a child of it.
Creates large text input fields.
Defines the table footer.
Creates a table cell title.
Defines the table title.
Defines date/time.
The title of an HTML document that appears at the top of the browser's title bar. May also appear in search results, so this should be taken into account when providing a title.
Creates a table row.
Adds subtitles for elements and .
Highlights a passage of text by underlining, without additional emphasis.
Creates a bulleted list.
Highlights variables from programs by displaying them in italics.
Adds video files to the page. Supports 3 video formats: MP4, WebM, Ogg.
Indicates to the browser where a long line might break.
Cheat sheet with tags

For ease of use, I grouped the tags into thematic sections, adding display property values ​​for each tag. To go to the table, click on the picture.

the body of the table is located. The body consists of rows and columns. The table is filled in line by line.

Each tag

columns are created. You can create multiple columns. In this case, you need to monitor the number of columns in each row. For example, if the first row had 5 columns, then the following rows should also have 5 columns. Otherwise the table will float. It is possible to merge cells.

How to make a table in html

Here's an example, html code:

Example table
Column 1 Column 2

Pay attention to the cell

. We use the special colspan attribute to span cells horizontally. Its numeric value indicates the number of columns to be merged. There is also an analogue of this attribute: a tag (table title), where you also need to specify colspan. The result will be the same. But often they use regular td.

Now let's take a closer look at all the tag attributes

.

Tag Attributes and Properties

To opening tag

You can specify various attributes.

1. Property align="parameter" - sets the table alignment. Can take the following values:

In the example above, we aligned the table to the center align="center" .

This attribute can be applied not only to the table, but also to individual table cells

. Thus, the alignment will be different in different cells.

For example

12. Property width="number" - sets the width of the table: either in pixels or in percentages.

13. Property class="class_name" - you can specify the name of the class to which the table belongs.

14. Property style="styles" - styles can be set individually for each table.

Now it's time to dive inside the table and look at the attributes of the table cells. These attributes should be written in the opening tag

And The same options are available as for will be hierarchically applied to all
or lines
... ... ...

2. Property background="URL" - sets the background image. Instead of the URL, the address of the background image should be written.

Example

Example table
Column 1 Column 2

Converts to the following on the page:

In the example above, our background image is located in the img folder (which is in the same directory as the html page), and the image is called fon.gif. Please note that in the tag we added style="color:white;" . Since the background is almost black, to prevent the text from blending into the background, we made the text white.

3. Property bgcolor="color" - sets the background color of the table. You can choose any color from the entire palette (see codes and names of html colors)

4. Property border="number" - sets the thickness of the table border. In previous examples, we specified border="1" , which means the border thickness is 1 pixel.

5. Property bordercolor="color" - sets the color of the border. If border="0" then there will be no border and the border color will have no meaning.

6. Property cellpadding="number" - indent from the frame to the cell contents in pixels.

7. Property cellspacing="number" - the distance between cells in pixels.

8. Property cols="number" - the number of columns. If you do not set it, the browser itself will determine the number of columns. The only difference is that specifying this parameter will most likely speed up the loading of the table.

9. Property frame="parameter" - how to display borders around the table. Can take the following values:

  • void - do not draw borders
  • border - border around the table
  • above - border along the top edge of the table
  • below - border at the bottom of the table
  • hsides - add only horizontal borders (top and bottom of table)
  • vsides - draw only vertical borders (to the left and right of the table)
  • rhs - border only on the right side of the table
  • lhs - border only on the left side of the table

10. Property height="number" - sets the height of the table: either in pixels or in percentages.

11. Property rules="parameter" - where to display borders between cells. Can take the following values:

  • all - a line is drawn around each table cell
  • groups - a line is displayed between groups that are formed by tags , , , or
  • cols - line is displayed between columns
  • none - all borders are hidden
  • rows - a border is drawn between table rows created through the tag
.

Attributes and Properties

1. Property align="parameter" - sets the alignment of an individual table cell. Can take the following values:

  • left - left alignment
  • center - center alignment
  • right - right alignment

2. Property background="URL" - sets the background image of the cell. Instead of the URL, the address of the background image should be written.

3. Property bgcolor="color" - sets the background color of the cell.

4. Property bordercolor="color" - sets the color of the cell border.

5. Property char="letter" - specifies the letter from which the alignment should be made. The value of the align attribute must be set to char.

6. Property colspan="number" - sets the number of horizontal cells to be merged.

7. Property height="number" - sets the height of the table: either in pixels or as a percentage.

8. Property width="number" - sets the width of the table: either in pixels or as a percentage.

9. Property rowspan="number" - sets the number of vertical cells to be merged.

10. Property valign="parameter" - vertical alignment of the cell contents.

  • top - align cell contents to the top edge of the row
  • middle - middle alignment
  • bottom - alignment to the bottom edge
  • baseline - alignment to the baseline
Note 1

For tag

. Parameters for one tag
inside him

How to prevent cell borders in a table from sticking together

If you use a border (cell border) and zero padding between cells, they are still stuck together and you get a double border . To avoid this, you need to specify border-collapse: collapse in the table styles:

...

Dear reader, now you have learned much more about html tag table. Now I advise you to move on to the next lesson.

In the life of every copywriter, there comes a stage of becoming familiar with html tags. Usually this happens spontaneously and looks like a request from the customer to “prepare the text for publication.” This means that in the article you need to highlight headings, paragraphs, significant places and lists, but not with Word capabilities, but with special ones html code language. Tags for a copywriter will help with this. The list required for work is usually small, but it is enough to format text with standard requirements. What is included in the html tags necessary for a copywriter? (If you are too lazy to read, then scroll down - there is a simple and clear thematic infographic about html tags!)

The copywriter asks traditional questions. And they all begin with the wording “what tag is used to specify...”:

  • title;
  • paragraph;
  • thumbnail;
  • italics;
  • list bulleted/unlabeled/

All this adds spice to the technical task and stimulates the acquisition of new knowledge. The situation gets worse when the task is to use the tag bold text to increase the attractiveness of the key in the PS. But all this can be solved very simply, which we will deal with now.

Tags for creating titles

Tags for creating headings are represented by elements h1-h6. They got their letter from the English Header (heading). To set the required type of heading and emphasize its significance for the PS, use following code:

Heading h1 Heading h2 Heading h3 Heading h4 Heading h5 Heading h6

On the website it will look like this.

Heading h1 Heading h2 Heading h3 Heading h4 Heading h5 Heading h6

The h1 heading has the most significance - and visibility -. It is used as the title of a post and is used only once. For subheadings in the text, h2 and h3 are recommended. They help to emphasize the significance of the material under consideration and divide the article into information levels.

Headers h4-h6 are practically not used, but they are in demand for highlighting logical blocks and important fragments.

For large articles it is best to use headings h1-h3, for small ones - h1 and h2.

Lists: bulleted and unlabeled

Structured good text always has one or even several lists. In my own way appearance lists are:

  • marked - they have numbering;
  • unmarked – elements are highlighted with symbols.
  • But all Word design is not suitable for publications on the site, so it’s worth learning how to properly format lists in HTML tags.
    Tag bulleted list looks like that:

    Tag an untagged list like this:

    Moreover, each list element has its own HTML frame:

    It turns out that in order to highlight a bulleted list in the text using html code, you will need to combine both types of elements used. It will look like this:

  • List item
  • List item
  • List item
  • List item
  • For an unmarked list it's similar:

    • List item
    • List item
    • List item
    • List item

    We've sorted out the lists. We can move on.

    Text emphasis tags: bold and italic

    When figuring out which tag allows you to correctly format the text, you almost immediately come across two code options for each case. This causes confusion among non-programmers and the question: what tag exactly does the customer need.

    Everything is very simple! Tags offer physical and logical formatting options. The first are needed for users, the second - for search engines. “Search engines”, seeing the html code suitable for themselves, take into account the selected area and use the information received when ranking, so highlighting text using logical formatting will not be a mistake.

    Using html tags makes it possible to please search engines and visually highlight the text for the user. What is more priority, decide for yourself:

    Highlighting a phrase in bold for PS and users Highlighting a phrase in bold for users Italicizing phrases for PS and users Italicize a phrase for users

    I have a large and very controversial article on the topic of bold tags, which is called.

    If suddenly one of the programmers looks into the topic, then I hasten to note once again that the review is for copywriters: how to put tags, what they are and what is important to consider when choosing. And finally, one more popular html code needed to highlight paragraphs. This

    The opening tag is placed before the beginning of the paragraph, and the closing tag is placed at the end. If a paragraph ends with a list, then
    is placed after all tags used for the list.

    Well, some simple thematic infographics at the end:

    When the discussion of the topic began in the comments, in the Club of Successful Copywriters an interesting answer was given to the info-graphics and article Feedback. Here is a screenshot of the opinion of an authoritative participant in the discussion.

    Read: 6,687

    Hello dear blog readers! In this article you will learn everything about how to insert an image into an html page. Do you have several images that you want to put on your page or do you want to put a logo on your site? All this is easy. After reading this article, you will be able to insert pictures into your html pages without any difficulties. To do this, we will talk in detail about the img tag and its attributes, and briefly consider the formats graphic files, such as gif, jpeg and png, and also look at new HTML5 features that make it easier to insert video and audio into your site.

    Due to the fact that graphic data and html text cannot be combined in one file; to display them on the site, a different approach is used than with other elements of html pages. First of all, graphic images, and other multimedia data is stored in separate files. And to implement them into a web page, they use special tags that contain links to these separate files. In particular, such a tag is the img tag. Having encountered such a tag with an address, the browser first requests the corresponding file with an image, audio or video from the Web server, and only then displays it on the Web page.

    All graphic images and, in general, any data that is stored in files separate from the web page are called embedded page elements.

    Before inserting pictures and looking at the “img” tag in detail, it’s worth learning a little about graphic formats.

    Graphic image formats.

    There are many different graphic formats, but browsers only support a few. Let's look at three of them.

    1. JPEG format ( Joint Photographic Experts Group). Quite a popular format used for storing images. Supports 24-bit color and keeps all halftones in photos unchanged. But jpeg does not support transparency and distorts small details and text in images. JPEG is used primarily for storing photographs. Files in this format have the extensions jpg, jpe, jpeg.

    2. GIF format ( Graphics Interchange Format). The main advantage of this format is the ability to store several images at once in one file. This allows you to create entire animated videos. Secondly, it supports transparency. The main drawback is that it supports only 256 colors, which is not suitable for storing photos. GIF is mainly used to store logos, banners, images with transparent areas and containing text. Files in this format have the extension gif.

    3. PNG format ( Portable Network Graphics). This format was developed as a replacement for the legacy GIF and, to some extent, JPEG. Supports transparency, but does not allow animation. This format has a png extension.

    When creating websites, they usually use images in JPEG or GIF format, but sometimes they use PNG. The main thing is to understand in which cases which format is better to use. In short:

      JPEG is best used for storing photographs or grayscale images that do not contain text;

    • GIF is used primarily for animation;
    • PNG is the format for everything else (icons, buttons, etc.).
    Inserting images into html pages

    So, how do you insert an image onto a web page? A single img tag allows you to insert an image. The browser places the image at the location on the web page where it encounters the img tag.

    The code for inserting an image into an html page looks like this:

    This html code will place on the web page an image stored in the image.jpg file, which is located in the same folder as the web page. As you may have noticed, the address of the image is indicated in the src attribute. I already told you what it is. So, the src attribute is a required attribute that serves to indicate the address of the file with the image. Without the src attribute, the img tag has no meaning.

    Here are a few more examples of specifying the address of a file with an image:

    This html code will insert an image on the page called image.jpg, which is stored in the images folder located at the root of the website.

    The src attribute can contain more than just relative links to images. Since images are stored online along with html pages, so each image file has its own url. Therefore, you can insert the image url into the src attribute. For example:

    This code will insert an image from the site mysite.ru onto the page. A URL is typically used when you are pointing to an image on another site. For images stored on your site, it is better to use relative links.

    The img tag is an inline element, so it is better to place it inside a block element, for example inside the “P” tag - paragraph:

    Let's practice and paste into our page from previous articles about html image. I will create an “images” folder next to the html file of my page and place a “bmw.jpg” image file there, which looks like this:

    Then the html code of the page with the inserted image will be like this:

    And look at the display result in the browser:

    As we see, there is nothing complicated about placing images on web pages. Next, let's look at a few other important attributes of the "img" tag.

    The alt attribute is a fallback option

    Because image files are stored separately from web pages, the browser has to make separate requests to retrieve them. But what if there are a lot of images on the page and the network connection speed is low, then loading additional files it will take considerable time. And it’s even worse if the image was deleted from the server without your knowledge.

    In these cases, the web page itself will load successfully, only white rectangles will be displayed instead of images. Therefore, to tell the user what the image is, . Using this attribute, you specify the so-called replacement text, which will be displayed in an empty rectangle until the image is loaded:

    And this is roughly what it looks like:

    Set the dimensions of the image

    There are still a couple of img tag attributes you should know about. This is a pair of width and height attributes. You can use these to specify the image dimensions:

    Both attributes specify the size in pixels. The width attribute tells the browser how wide the image should be, and the height attribute how tall it should be. These two attributes can be used together or separately. For example, if you specify only the width attribute, then the browser will automatically select the height in proportion to the specified width and also in the case of using only the height attribute. If you do not specify these attributes at all, the browser will automatically determine the size of the image before displaying it on the screen. It is only worth noting that specifying the image sizes will slightly speed up the browser when displaying the page.

    That’s all about inserting images onto pages for now, then we’ll look at how to insert audio or video onto a website...

    Insert video and audio from using HTML 5

    The new html5 specification introduces several new tags that make it very easy to embed media files. This primarily applies to video and audio.

    For inserting audio HTML5 provides paired tag AUDIO. The address of the file in which the audio clip is stored is indicated using the src attribute that is already familiar to us:

    The “audio” tag creates a block element on the page. By default, the browser will not play the audio clip. For it to do this, you need to specify a special autoplay attribute in the audio tag. Special because it doesn't matter. The mere presence of this attribute in the tag is enough for it to take effect.

    By default, the audio clip is not displayed on the web page. But if you put an attribute in the “audio” tag without the controls value, the browser will display audio playback controls in the place on the web page where the audio tag is placed. They include a play/pause button, a playback bar, and a volume control.

    The two main formats used for inserting images into HTML are GIF and JPEG. The GIF format can store simple animation(dynamic banners), JPEG is great for images with big amount flowers, such as photographs. The third format for web graphics is PNG format, but it is not widely used in web design. Any image in GIF or JPEG formats is inserted onto a web page using the tag< img >, there is no closing tag.

    SRC attribute

    The src attribute specifies the address (URL) of the image file, i.e. the browser finds the desired image in the site directory using the path (URL) specified in this attribute. For convenience, all site images are located in a separate folder, usually named image . For example, take any image, preferably a small format, and save it in the created image folder, with the name primer.jpg. Next we will refer to it for training.

    Well, let's try to insert a picture on the page? We write the code (path - URL, written depending on the location of the folder with images):

    < img src="image/primer.jpg">

    Alternative text. ALT attribute

    Why is alternative text specified? Let's go in order. Every browser has a function to disable images, so a user using this function can see the description specified in the tag alt, which represents the image. This may not be relevant today, since preference is given to unlimited tariffs, but still this is considered a rule of good manners. Let's look at the code example:

    You can see this only by turning off the display of images in the browser.

    Set the size. WIDTH and HEIGHT attributes

    Let me note right away that width and height are very important parameters, so you shouldn’t ignore them. Judge for yourself, with unspecified image sizes, and with images disabled in the browser, when images do not load, small empty squares may be located in a completely different place from where you planned to place them. This will not add beauty to the page. Therefore, do not be lazy and always write down the dimensions in the HTML code.

    Image sizes are set using tags width- width and height— height, values ​​are set both in pixels and as a percentage of the screen width (with percentages, be very careful). Let's look at the code:

    Conclusion

    Images attract site visitors and carry a lot of visual information, are easy to use, but you still need to follow some recommendations if you want to create a good, popular website.

    You should not use too large image file sizes, as this will affect page loading speed. Believe me, this is far from the last indicator.

    The ALT attribute has a very important, you must add it for each IMG tag. Content text message must describe the image very accurately, and briefly.

    Images on a web page must correspond to the text content.

    After studying this section, you can already try yourself as a webmaster and create a full-fledged HTML page. And then let's move on to inserting multimedia.

    Computer