{"id":100,"date":"2026-04-10T08:40:36","date_gmt":"2026-04-10T08:40:36","guid":{"rendered":"https:\/\/gigz.pk\/html\/?post_type=lesson&#038;p=100"},"modified":"2026-04-27T13:32:07","modified_gmt":"2026-04-27T13:32:07","slug":"image-paths-relative-vs-absolute","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/","title":{"rendered":"Image Paths (Relative vs Absolute)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Image paths in HTML define the location of an image file. The browser uses these paths to find and display images on a web page. There are two main types of image paths: relative paths and absolute paths.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What is an Image Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An image path tells the browser where the image is stored. It can be inside your project folder or on another website.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Relative Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A relative path shows the location of an image relative to the current HTML file. It is used when the image is stored inside your project folder.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example of Relative Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img src=&#8221;images\/photo.jpg&#8221; alt=&#8221;Sample Image&#8221;&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the image is inside the images folder within the same project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>When to Use Relative Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use relative paths when working on your own website files. They are commonly used in real projects because they keep files organized and easy to move.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Absolute Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An absolute path is the full URL of an image that is hosted on the internet. It includes the complete web address.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example of Absolute Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img src=&#8221;https:\/\/example.com\/images\/photo.jpg&#8221; alt=&#8221;Online Image&#8221;&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>When to Use Absolute Path<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use absolute paths when using images from external websites or online sources.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Main Difference<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Relative paths point to images inside your project folder.<br>Absolute paths point to images located on another website using a full URL.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Image paths help the browser locate and display images. Relative paths are used for local project files, while absolute paths are used for online images.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777296643173\"><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 Paths (Relative vs Absolute)<\/span><\/span><\/div>","protected":false},"menu_order":22,"template":"","class_list":["post-100","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 Paths (Relative vs Absolute) - HTML learning mastery<\/title>\n<meta name=\"description\" content=\"Learn HTML image paths with relative and absolute examples. Understand how browsers find and display images easily.\" \/>\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-paths-relative-vs-absolute\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Image Paths (Relative vs Absolute) - HTML learning mastery\" \/>\n<meta property=\"og:description\" content=\"Learn HTML image paths with relative and absolute examples. Understand how browsers find and display images easily.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/\" \/>\n<meta property=\"og:site_name\" content=\"HTML learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-27T13:32:07+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=\"2 minutes\" \/>\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-paths-relative-vs-absolute\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-paths-relative-vs-absolute\\\/\",\"name\":\"Image Paths (Relative vs Absolute) - HTML learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/#website\"},\"datePublished\":\"2026-04-10T08:40:36+00:00\",\"dateModified\":\"2026-04-27T13:32:07+00:00\",\"description\":\"Learn HTML image paths with relative and absolute examples. Understand how browsers find and display images easily.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-paths-relative-vs-absolute\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-paths-relative-vs-absolute\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/image-paths-relative-vs-absolute\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/html\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML Fundamentals (Beginner) > Images & Media > Image Paths (Relative vs Absolute)\"}]},{\"@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 Paths (Relative vs Absolute) - HTML learning mastery","description":"Learn HTML image paths with relative and absolute examples. Understand how browsers find and display images easily.","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-paths-relative-vs-absolute\/","og_locale":"en_US","og_type":"article","og_title":"Image Paths (Relative vs Absolute) - HTML learning mastery","og_description":"Learn HTML image paths with relative and absolute examples. Understand how browsers find and display images easily.","og_url":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/","og_site_name":"HTML learning mastery","article_modified_time":"2026-04-27T13:32:07+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/","url":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/","name":"Image Paths (Relative vs Absolute) - HTML learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/html\/#website"},"datePublished":"2026-04-10T08:40:36+00:00","dateModified":"2026-04-27T13:32:07+00:00","description":"Learn HTML image paths with relative and absolute examples. Understand how browsers find and display images easily.","breadcrumb":{"@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/image-paths-relative-vs-absolute\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/html\/"},{"@type":"ListItem","position":2,"name":"HTML Fundamentals (Beginner) > Images & Media > Image Paths (Relative vs Absolute)"}]},{"@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\/100","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=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}