{"id":98,"date":"2026-04-10T08:39:21","date_gmt":"2026-04-10T08:39:21","guid":{"rendered":"https:\/\/gigz.pk\/html\/?post_type=lesson&#038;p=98"},"modified":"2026-04-27T13:32:45","modified_gmt":"2026-04-27T13:32:45","slug":"image-tag-img","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/","title":{"rendered":"Image Tag (&lt;img>)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The image tag in HTML is used to display images on a web page. Images make websites more attractive and help present information in a visual form.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What is the Image Tag<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The image tag is written as &lt;img&gt;. It is an empty tag, which means it does not have a closing tag.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Basic Structure<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The image tag uses attributes to define the image source and description.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example of Image Tag<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img src=&#8221;image.jpg&#8221; alt=&#8221;Sample Image&#8221;&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>src Attribute<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The src attribute is used to define the path or location of the image file. It tells the browser where the image is stored.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>alt Attribute<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The alt attribute provides alternative text for the image. If the image does not load, this text will be shown. It also helps screen readers and improves SEO.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Image Paths<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Images can be added using different types of paths depending on where the file is stored.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Relative Path Example<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img src=&#8221;images\/photo.jpg&#8221; alt=&#8221;Photo&#8221;&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Absolute Path Example<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img src=&#8221;https:\/\/example.com\/photo.jpg&#8221; alt=&#8221;Online Image&#8221;&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why Images are Important<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Images make web pages more engaging and easier to understand. They improve the design and help users connect with the content.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The image tag is used to insert images in HTML pages. It uses the src attribute to load the image and the alt attribute to describe it.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777296202725\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/html\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">HTML Fundamentals (Beginner) > Images &#038; Media > Image Tag ()<\/span><\/span><\/div>","protected":false},"menu_order":21,"template":"","class_list":["post-98","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Image Tag (&lt;img&gt;) - HTML learning mastery<\/title>\n<meta name=\"description\" content=\"Learn HTML image tag with src and alt. Add images using relative or absolute paths to improve design and SEO.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Image Tag (&lt;img&gt;) - HTML learning mastery\" \/>\n<meta property=\"og:description\" content=\"Learn HTML image tag with src and alt. Add images using relative or absolute paths to improve design and SEO.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/\" \/>\n<meta property=\"og:site_name\" content=\"HTML learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-27T13:32:45+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-tag-img\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-tag-img\\\/\",\"name\":\"Image Tag (&lt;img>) - HTML learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/#website\"},\"datePublished\":\"2026-04-10T08:39:21+00:00\",\"dateModified\":\"2026-04-27T13:32:45+00:00\",\"description\":\"Learn HTML image tag with src and alt. Add images using relative or absolute paths to improve design and SEO.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-tag-img\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-tag-img\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-tag-img\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/html\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML Fundamentals (Beginner) > Images & Media > Image Tag ()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/html\\\/\",\"name\":\"HTML learning mastery\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/html\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Image Tag (&lt;img>) - HTML learning mastery","description":"Learn HTML image tag with src and alt. Add images using relative or absolute paths to improve design and SEO.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/","og_locale":"en_US","og_type":"article","og_title":"Image Tag (&lt;img>) - HTML learning mastery","og_description":"Learn HTML image tag with src and alt. Add images using relative or absolute paths to improve design and SEO.","og_url":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/","og_site_name":"HTML learning mastery","article_modified_time":"2026-04-27T13:32:45+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/","url":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/","name":"Image Tag (&lt;img>) - HTML learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/html\/#website"},"datePublished":"2026-04-10T08:39:21+00:00","dateModified":"2026-04-27T13:32:45+00:00","description":"Learn HTML image tag with src and alt. Add images using relative or absolute paths to improve design and SEO.","breadcrumb":{"@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-tag-img\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/html\/"},{"@type":"ListItem","position":2,"name":"HTML Fundamentals (Beginner) > Images & Media > Image Tag ()"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/html\/#website","url":"https:\/\/gigz.pk\/html\/","name":"HTML learning mastery","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/html\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/html\/index.php\/wp-json\/wp\/v2\/lesson\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/html\/index.php\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/html\/index.php\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/html\/index.php\/wp-json\/wp\/v2\/media?parent=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}