{"id":33958,"date":"2017-10-27T03:01:39","date_gmt":"2017-10-26T17:01:39","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=33958"},"modified":"2017-10-27T16:33:11","modified_gmt":"2017-10-27T06:33:11","slug":"html5-picture-tag-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-picture-tag-primer-tutorial\/","title":{"rendered":"HTML5 Picture Tag Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/using_picture.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"HTML5 Picture Tag Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/using_picture.jpg\" title=\"HTML5 Picture Tag Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">HTML5 Picture Tag Primer Tutorial<\/p><\/div>\n<p>You may have heard of the term &#8220;responsive design&#8221; with regard to web design, especially in this mobile device world of so many and varied device dimensions.   Wikipedia describes <a target=_blank title='Responsive Web Design' href='https:\/\/en.wikipedia.org\/wiki\/Responsive_web_design'>&#8220;responsive web design&#8221;<\/a> in this way &#8230;<\/p>\n<blockquote cite='https:\/\/en.wikipedia.org\/wiki\/Responsive_web_design'><p>\nResponsive web design (RWD) is an approach to web design which makes web pages render well on a variety of devices and window or screen sizes.\n<\/p><\/blockquote>\n<p> &#8230; and when you grapple with this &#8220;responsive web design&#8221; idea first hand, one of the biggest issues will be to do with the HTML &#8220;img&#8221; image tag, regarding the width (and height) of that element.  You will see lots of advice to use &#8220;%&#8221; units for width, and when forced for an equivalent height perhaps you use &#8220;vh&#8221; units.<\/p>\n<p>All that is good advice, certainly, but there is a new element to HTML via the HTML5 specification to effectively &#8220;respond&#8221; to a nominated minimum width and display a nominated image under those conditions, for how every many minimum width scenarios of interest.  We based a small &#8220;proof of concept&#8221; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/using_picture.html\" title=\"Click picture\">live run<\/a> on the ideas from <a target=_blank title='https:\/\/www.w3schools.com\/tags\/tag_picture.asp' href='https:\/\/www.w3schools.com\/tags\/tag_picture.asp'>W3Schools<\/a>, thanks.<\/p>\n<p>You can download the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/using_picture.html_GETME\" title=\"using_picture.html\">using_picture.html<\/a> HTML code as you wish, but we also present it as a whole below (because it&#8217;s pretty small) &#8230;<\/p>\n<p><code><br \/>\n&lt;!doctype html&gt;<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;title&gt;HTML Picture Element - RJM Programming - October, 2017&lt;\/title&gt;<br \/>\n&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;table style=\"width:100%;\"&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td style=\"width:80%;vertical-align:top;\"&gt;<br \/>\n&lt;h1&gt;HTML Picture Element&lt;\/h1&gt;<br \/>\n&lt;h3&gt;RJM Programming - October, 2017&lt;\/h3&gt;<br \/>\n&lt;h4&gt;Thanks to &lt;a target=_blank title='https:\/\/www.w3schools.com\/tags\/tag_picture.asp' href='https:\/\/www.w3schools.com\/tags\/tag_picture.asp'&gt;https:\/\/www.w3schools.com\/tags\/tag_picture.asp&lt;\/a&gt;&lt;\/h4&gt;<br \/>\n&lt;p&gt;Feel free to resize window and see the image to the right change as a result or open as &lt;a onclick=\"window.open(document.URL,'_blank','top=300,left=0,width=50,height=50');\" style=\"cursor:pointer; text-decoration: underline;\"&gt;50 x 50&lt;\/a&gt; &lt;a onclick=\"window.open(document.URL,'_blank','top=300,left=0,width=150,height=150');\" style=\"cursor:pointer; text-decoration: underline;\"&gt;150 x 150&lt;\/a&gt;  &lt;a onclick=\"window.open(document.URL,'_blank','top=300,left=0,width=250,height=250');\" style=\"cursor:pointer; text-decoration: underline;\"&gt;250 x 250&lt;\/a&gt;  &lt;a onclick=\"window.open(document.URL,'_blank','top=300,left=0,width=350,height=350');\" style=\"cursor:pointer; text-decoration: underline;\"&gt;350 x 350&lt;\/a&gt;  &lt;a onclick=\"window.open(document.URL,'_blank','top=300,left=0,width=850,height=850');\" style=\"cursor:pointer; text-decoration: underline;\"&gt;850 x 850&lt;\/a&gt;&lt;\/p&gt;<br \/>\n&lt;\/td&gt;&lt;td style=\"width:20%;\"&gt;<br \/>\n<b>&lt;picture&gt;<br \/>\n  &lt;source media=\"(min-width: 650px)\" srcset=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/travel_img.jpg\"&gt;<br \/>\n  &lt;source media=\"(min-width: 465px)\" srcset=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/NalaAtPlay1.jpg\"&gt;<br \/>\n  &lt;img src=\"http:\/\/www.rjmprogramming.com.au\/logo_old_okay.jpg\" alt=\"Logo\" style=\"width:auto;\"&gt;<br \/>\n&lt;\/picture&gt;<\/b><br \/>\n&lt;\/td&gt;&lt;\/tr&gt;&lt;\/table&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n<\/code><\/p>\n<p>Below is a &#8220;smaller width&#8221; live run &#8230;<\/p>\n<p><iframe src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/using_picture.html\" title=\"using_picture.html\" style=\"width:100%;height:300px;\"><\/iframe><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d33958' onclick='var dv=document.getElementById(\"d33958\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/image\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d33958' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>You may have heard of the term &#8220;responsive design&#8221; with regard to web design, especially in this mobile device world of so many and varied device dimensions. Wikipedia describes &#8220;responsive web design&#8221; in this way &#8230; Responsive web design (RWD) &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-picture-tag-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[576,578,590,2375,997,1991,1319,1407],"class_list":["post-33958","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-html","tag-html5","tag-image","tag-picture","tag-programming","tag-responsive-design","tag-tutorial","tag-web-design"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33958"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=33958"}],"version-history":[{"count":18,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33958\/revisions"}],"predecessor-version":[{"id":33981,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33958\/revisions\/33981"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=33958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=33958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=33958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}