...
Dear reader, now you have learned much more about the html table tag. 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 html code language. Will help with this tags for copywriter. 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 start 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 a bold text tag 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 header and emphasize its significance for the PS, use the 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:
Unbulled list tag So:
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
Bold phrase 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 tags oily discharge, which is called that.
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 required 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 for the info-graphics and article Feedback. Here is a screenshot of the opinion of an authoritative participant in the discussion.
Read: 6,687
Before answering the question " how to insert a picture in HTML?“, it should be noted that it is not worth overloading web pages with a huge amount of graphic material, since this will not only improve the visual perception of the resource by the user, but will also increase the page loading time.
When creating websites, the most commonly used graphic formats are PNG, GIF and JPEG, and for design work with images - graphics editor Adobe Photoshop, which has rich capabilities for compressing and resizing images without losing quality, which is incredibly important for web development.
How to insert an image in HTML?
To insert an image into an HTML page, use a single simple tag:
,
where xxx is the image address. If the image is in the same directory as the page, the tag will look like:
However, high-speed and stable Internet has not yet reached all corners of the globe, and it happens that the image on the website simply does not load. For such cases, there is the concept of alternative text.
It is shown in place of the picture when it is unavailable, loading, or in the browser operating mode “without pictures”. It is added using the alt tag attribute .
Example of adding alternative text to a graphic file:
Alternative text
Assigning image sizes in HTML
In order to change the display dimensions of a graphic file, use the height and width tags, where height is the height and width is the width, measured in pixels.
When using these attributes, the browser first allocates space for graphic content, prepares the overall page layout, displays text, and then loads the image itself.
The picture is placed in a rectangle with the specified dimensions, and if the parameters are smaller or larger than the original ones, the picture is stretched or compressed.
If the height and width attributes are not used, the browser loads the image immediately, delaying the display of text and other page elements.
These parameters can be specified both in pixels (the size of the picture is constant and does not depend on the user’s screen resolution) and in percentages (the size of the picture depends on the screen resolution).
For example:
It should be remembered that at the moment when you change the original size of the image, it is necessary to maintain its proportions.
To do this, it is enough to specify the value of only one of the parameters ( width or height), and the browser will calculate the value of the second one automatically.
Image location in HTML
As with many HTML tags, To Apply the align attribute, which aligns the image:
- the picture is located above the text;
- the picture is located below the text;
- the picture is located to the left of the text;
- the picture is located to the right of the text.
Picture link
This is done as follows:
As you can see, graphic insert can be a link and, when clicked, redirect to any address written in full or abbreviated form.
How can I make an image a background in HTML?
The image can not only be inserted onto the page as a visible object, but also made into the background. To define an image as a background, you need to specify the background=”xxx” attribute in the tag, where xxx is the address of the image, specified in the same way as in the examples above.
For example, let's set the following texture image as a background image:
Save the image in a folder with a prepared page and write the following lines:
Page with background image
Background with text.
The background image on the page is set.
To insert images in HTML The two main formats used are GIF and JPEG. The GIF format can store simple animation(dynamic banners), JPEG is great for images with a lot of color, 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
Via attribute src the address (URL) of the image file is specified, 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 folder image, 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, 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 site.
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 is very important and must be added to every IMG tag. The content of the text message must describe the image very accurately and concisely.
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.
Hello dear blog readers! In this article you will learn everything about how to insert an image on 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 img tag and its attributes, we'll take a quick look at graphic file formats 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; a different approach is used to display them on the site than with other elements of html pages. First of all, graphic images and other multimedia data are stored in separate files. And to embed them into a web page, special tags are used that contain links to these individual files. In particular, such a tag is 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 implemented 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:
Inserting images into html pages
So, how do you insert an image onto a web page? You can insert an image using a single img tag. The browser places the image at the location on the web page where it encounters the img tag.
Code for inserting images into html the 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 picture is indicated in 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 is meaningless.
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 not only relative links to the 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 couple of attributes width And height. You can use these to specify the image dimensions:
Both attributes indicate 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...
Inserting video and audio 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.
To insert 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 attribute in the audio tag autoplay. 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 without a value in the “audio” tag controls, the browser will display in the place on the web page where audio tag, audio playback controls. They include a play/pause button, a playback bar, and a volume control.