0 points

Image tag <img> to insert images


dashboard

Tue Jan 07 2020 19:00:00 GMT+0000 (UTC)

Posted by @toast-ghost #html #htmltags #webdev #basics #html5

<img 
	src="example.com/cat.png" 
    alt="Photo of a cat" 
    height="50" 
    width="100"
    longdesc="#catDetails"
 >
content_copy

Line 2: The src attribute specifies the path where the image is located. If located internally, you can use a relative URL like src="images/cat.png" instead of an absolute one like in this example. Line 3: If for some reason the image does not load, text specified in the alt attribute will be displayed instead. It is also used for accessibility devices and tools. Furthermore, text in the alt attribute helps boost SEO if the right keywords are used. Lines 4-5: Specifies the width and height of the image in pixels. But not good practice to use because it is fixed and not good for responsive layouts. Better to specify the size in CSS. Line 6: Specifies a hyperlink to a detailed description of an image. Can be to an absolute URL, relative URL or an ID (like in this example) to jump to a specific point on the same page.


>> Browse more code snippets

more_vert