{"id":108,"date":"2026-04-10T08:49:50","date_gmt":"2026-04-10T08:49:50","guid":{"rendered":"https:\/\/gigz.pk\/html\/?post_type=lesson&#038;p=108"},"modified":"2026-04-27T14:12:20","modified_gmt":"2026-04-27T14:12:20","slug":"responsive-images","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/","title":{"rendered":"Responsive Images"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Responsive images in HTML are images that automatically adjust their size according to different screen sizes like mobile, tablet, and desktop. They help make websites look good on all devices.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What are Responsive Images<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Responsive images change their width and height based on the screen size so that they do not break the layout or appear too large on small screens.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why Responsive Images are Important<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Responsive images improve user experience on all devices. They also help websites load faster and look more professional on mobile screens.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using CSS for Responsive Images<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The most common way to make images responsive is by using CSS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example of Responsive Image<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;img src=&#8221;image.jpg&#8221; alt=&#8221;Sample Image&#8221; style=&#8221;width: 100%; height: auto;&#8221;&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the image will always fit the width of its container.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>max-width Property<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Another common method is using max-width in CSS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example using max-width<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">img {<br>max-width: 100%;<br>height: auto;<br>}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This ensures the image never becomes larger than its original size.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using the picture Tag<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The picture tag allows different images for different screen sizes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example of Picture Tag<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;picture&gt; &lt;source srcset=&#8221;small.jpg&#8221; media=&#8221;(max-width: 600px)&#8221;&gt; &lt;source srcset=&#8221;large.jpg&#8221; media=&#8221;(min-width: 601px)&#8221;&gt; &lt;img src=&#8221;default.jpg&#8221; alt=&#8221;Responsive Image&#8221;&gt; &lt;\/picture&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Responsive images automatically adjust to different screen sizes. They improve design, speed, and user experience on all devices using CSS and HTML techniques.<\/p>\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 > Responsive Images<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777299120466\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":25,"template":"","class_list":["post-108","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>Responsive Images - HTML learning mastery<\/title>\n<meta name=\"description\" content=\"Learn responsive images in HTML using CSS and picture tag. Make images fit all screen sizes for better design and UX.\" \/>\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\/responsive-images\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Responsive Images - HTML learning mastery\" \/>\n<meta property=\"og:description\" content=\"Learn responsive images in HTML using CSS and picture tag. Make images fit all screen sizes for better design and UX.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/\" \/>\n<meta property=\"og:site_name\" content=\"HTML learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-27T14:12:20+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\\\/responsive-images\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/responsive-images\\\/\",\"name\":\"Responsive Images - HTML learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/#website\"},\"datePublished\":\"2026-04-10T08:49:50+00:00\",\"dateModified\":\"2026-04-27T14:12:20+00:00\",\"description\":\"Learn responsive images in HTML using CSS and picture tag. Make images fit all screen sizes for better design and UX.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/responsive-images\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/responsive-images\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/html\\\/index.php\\\/lesson\\\/responsive-images\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/html\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML Fundamentals (Beginner) > Images & Media > Responsive Images\"}]},{\"@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":"Responsive Images - HTML learning mastery","description":"Learn responsive images in HTML using CSS and picture tag. Make images fit all screen sizes for better design and UX.","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\/responsive-images\/","og_locale":"en_US","og_type":"article","og_title":"Responsive Images - HTML learning mastery","og_description":"Learn responsive images in HTML using CSS and picture tag. Make images fit all screen sizes for better design and UX.","og_url":"https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/","og_site_name":"HTML learning mastery","article_modified_time":"2026-04-27T14:12:20+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\/responsive-images\/","url":"https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/","name":"Responsive Images - HTML learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/html\/#website"},"datePublished":"2026-04-10T08:49:50+00:00","dateModified":"2026-04-27T14:12:20+00:00","description":"Learn responsive images in HTML using CSS and picture tag. Make images fit all screen sizes for better design and UX.","breadcrumb":{"@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/html\/index.php\/lesson\/responsive-images\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/html\/"},{"@type":"ListItem","position":2,"name":"HTML Fundamentals (Beginner) > Images & Media > Responsive Images"}]},{"@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\/108","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=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}