In this example, we'll scale the image to be smaller (for demonstration purposes), however, this is not recommended. In this snippet, you can find the solution of setting the equivalent of “src” attribute of an tag. This attribute helps specify the image's source, which means this, instruct your web browser from which location it must fetch the particular picture (in other words, specify the path). –>, © 2015-2020 Sitemap | Privacy | Contact, Adam is a technical writer who specializes in developer documentation and. name gives the name to the segment. It can be used with any HTML tag. Most meaningful images are going to create insanely long strings (just see the example above), and they actually don’t load as fast as external files. If the URL begins with a slash, it will be relative to the domain. It is almost always the best idea to use source URLs which are relative to the domain, not the page. What matters, though, is — what kind of image is it? Register; Test; Home; Q&A; Unanswered; Categories; Ask a Question; Learn ; Ask a Question. The image defined by the URL is retrieved by the browser and inserted into the document when the page loads. To apply the style on the HTML tag… So it is very important to always include the src attribute in your images. The tag is written as (no end tag) with the image URL inserted between the double quotes of the src attribute. The src attribute used to specify the name of the media file with its source location. sizes 1. If you continue to use this site we will assume that you are happy with it. It is used when you want to be sure that the image is indeed the same one that the author intended, and hasn't been modified in any way. The image must have the alt attribute specified. This element includes the global attributes. This is important, as it is possible that not all users will be able to see the image. Both attributes have been deprecated. You then use the string as if it were a URL, and then the browser simply interprets it as if it were a file. The kind of image file you use should depend on what the content of the image is. Is it a c# string, use e.g. The above code alone doesn’t play the music or show anything. Its value is a descriptive text displayed in the browser before the image is loaded. share | improve this question | follow | asked Dec 11 at 7:00. You can read more about the , ,