{"id":13412,"date":"2015-04-09T05:03:22","date_gmt":"2015-04-08T19:03:22","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=13412"},"modified":"2015-04-09T05:03:22","modified_gmt":"2015-04-08T19:03:22","slug":"html-whitespace-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-whitespace-primer-tutorial\/","title":{"rendered":"HTML Whitespace Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Whitespace.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"HTML Whitespace Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Whitespace.jpg\" title=\"HTML Whitespace Primer Tutorial\"    \/><\/a><p class=\"wp-caption-text\">HTML Whitespace Primer Tutorial<\/p><\/div>\n<p>Whitespace in HTML can be a very confusing area for web developers, especially when HTML elements <a target=_blank title='Float CSS information from w3schools' href='http:\/\/www.w3schools.com\/css\/css_float.asp'><i>float<\/i><\/a>.  Even though there are lots of facilities in CSS to overcome the whitespace issues to do with <a target=_blank title='Margin CSS information from w3schools' href='http:\/\/www.w3schools.com\/css\/css_margin.asp'><i>margin<\/i><\/a>, <a target=_blank title='Padding CSS information from w3schools' href='http:\/\/www.w3schools.com\/css\/css_padding.asp'><i>padding<\/i><\/a> and even <a target=_blank title='Border CSS information from w3schools' href='http:\/\/www.w3schools.com\/css\/css_border.asp'><i>border<\/i><\/a> (in a less direct way), lots of times we like the more direct ideas of <a target=_blank href='http:\/\/en.wikipedia.org\/wiki\/WYSIWYG' title='What you see is what you get information from Wikipedia ... thanks'>WYSIWYG<\/a> and try to fix issues just using HTML methods, and this sounds fair enough to me &#8230; but consider the Good Look Vs Bad Look (of <a target=_blank title='HTML Canvas Golf Accuracy Game Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=13308'>HTML Canvas Golf Accuracy Game Primer Tutorial<\/a>) below &#8230;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- Good Look below &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The HTML <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>Canvas<\/a> element is great for games where you draw your own graphics based on interaction from the user &#8230; a great tool to have in your GUI toolbox &#8230;  <\/p>\n<blockquote class=\"rightbq\"><p>\nyou download an app and start playing.\n<\/p><\/blockquote>\n<p><\/p>\n<p>A lot of the logic of these games stem from when a user clicks on the <i>canvas<\/i> element &#8230; translation:<br \/>\n&nbsp;<\/p>\n<blockquote class=\"rightbq\"><p>\ndon&#8217;t read any rules of the game and just start clicking away <strike>man<\/strike> &#8230; person.\n<\/p><\/blockquote>\n<p><\/p>\n<p>Lots of these games are based on sport  &#8230; translation:<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<blockquote class=\"rightbq\"><p>\ndoh!  show me the ball!  show me the ball!\n<\/p><\/blockquote>\n<p><\/p>\n<p>And quite often that sport is golf  &#8230; translation:<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<blockquote class=\"rightbq\"><p>\npass me the plus fours <strike>man<\/strike> &#8230; person &#8230; and forget the rules &#8230; show me the ball!  show me the ball!\n<\/p><\/blockquote>\n<p><\/p>\n<p>Today, if you&#8217;d like to <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/golfshotcanvas.html\">play<\/a>, we get the user to click twice to simulate the start and end position of their golf shot, the direction and size of which is predetermined, and shown to them &#8230; translation:<br \/>\n&nbsp;<\/p>\n<blockquote class=\"rightbq\"><p>\nwhat?!  no ball &#8230; well then, show me the wrestler.\n<\/p><\/blockquote>\n<p><\/p>\n<p>Today we don&#8217;t show a ball, as such &#8230; it&#8217;s too small &#8230; translation:<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<blockquote class=\"rightbq\"><p>\nwe need this room for another meeting.<br \/>\n&nbsp;\n<\/p><\/blockquote>\n<p><\/p>\n<p>Hope you enjoy playing the game derived from <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/golfshotcanvas.html_GETME\" totle=\"golfshotcanvas.html\">golfshotcanvas.html<\/a> &#8230; you start with score of 3000 and excel by how many goes you survive with a score &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\nbye.<br \/>\n&nbsp;<br \/>\nturn out the lights as you go.\n<\/p><\/blockquote>\n<p><\/p>\n<p>If you&#8217;re looking for <a target=_blank title='?' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/faint_grass_pattern_204850.jpg'>grass<\/a> <strike>man<\/strike> &#8230; person &#8230; the free background image came from <a target=_blank href=\"http:\/\/all-free-download.com\/free-photos\/ ... thanks\" title=\"Grass courtesy of http:\/\/all-free-download.com\/free-photos\/ ... thanks\">http:\/\/all-free-download.com\/free-photos\/<\/a> and then was modified for use here via Gimp (good old Gimp &#8230; reduction in Opacity to 40%) &#8230; thanks &#8230; translation:\n<\/p>\n<p><\/p>\n<p>There are night golf ranges you know!!!!<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- Bad Look below &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>The HTML <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>Canvas<\/a> element is great for games where you draw your own graphics based on interaction from the user &#8230; a great tool to have in your GUI toolbox &#8230;  <\/p>\n<blockquote class=\"rightbq\"><p>\nyou download an app and start playing.\n<\/p><\/blockquote>\n<p><\/p>\n<p>A lot of the logic of these games stem from when a user clicks on the <i>canvas<\/i> element &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\ndon&#8217;t read any rules of the game and just start clicking away <strike>man<\/strike> &#8230; person.\n<\/p><\/blockquote>\n<p><\/p>\n<p>Lots of these games are based on sport  &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\ndoh!  show me the ball!  show me the ball!\n<\/p><\/blockquote>\n<p><\/p>\n<p>And quite often that sport is golf  &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\npass me the plus fours <strike>man<\/strike> &#8230; person &#8230; and forget the rules &#8230; show me the ball!  show me the ball!\n<\/p><\/blockquote>\n<p><\/p>\n<p>Today, if you&#8217;d like to <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/golfshotcanvas.html\">play<\/a>, we get the user to click twice to simulate the start and end position of their golf shot, the direction and size of which is predetermined, and shown to them &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\nwhat?!  no ball &#8230; well then, show me the wrestler.\n<\/p><\/blockquote>\n<p><\/p>\n<p>Today we don&#8217;t show a ball, as such &#8230; it&#8217;s too small &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\nwe need this room for another meeting.<\/p>\n<\/blockquote>\n<p><\/p>\n<p>Hope you enjoy playing the game derived from <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/golfshotcanvas.html_GETME\" totle=\"golfshotcanvas.html\">golfshotcanvas.html<\/a> &#8230; you start with score of 3000 and excel by how many goes you survive with a score &#8230; translation: <\/p>\n<blockquote class=\"rightbq\"><p>\nbye.<\/p>\n<p>turn out the lights as you go.\n<\/p><\/blockquote>\n<p><\/p>\n<p>If you&#8217;re looking for <a target=_blank title='?' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/faint_grass_pattern_204850.jpg'>grass<\/a> <strike>man<\/strike> &#8230; person &#8230; the free background image came from <a target=_blank href=\"http:\/\/all-free-download.com\/free-photos\/ ... thanks\" title=\"Grass courtesy of http:\/\/all-free-download.com\/free-photos\/ ... thanks\">http:\/\/all-free-download.com\/free-photos\/<\/a> and then was modified for use here via Gimp (good old Gimp &#8230; reduction in Opacity to 40%) &#8230; thanks &#8230; translation:\n<\/p>\n<p><\/p>\n<p>There are night golf ranges you know!!!!<\/p>\n<p>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; HTML Code Looks Like &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<table>\n<tr>\n<th>Good Look of Code<\/th>\n<th>Bad Look of Code<\/th>\n<\/tr>\n<tr>\n<td>\n<code><br \/>\n&lt;p&gt;Lots of these games are based on sport  ... translation:<br \/>\n&amp;nbsp;<br \/>\n&amp;nbsp;<br \/>\n&amp;nbsp;<br \/>\n&amp;nbsp;<br \/>\n&lt;blockquote class=\"rightbq\"&gt;<br \/>\ndoh!  show me the ball!  show me the ball!<br \/>\n&lt;\/blockquote&gt;<br \/>\n&lt;\/p&gt;<br \/>\n<\/code>\n<\/td>\n<td>\n<code><br \/>\n&lt;p&gt;Lots of these games are based on sport  ... translation:<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&lt;blockquote class=\"rightbq\"&gt;<br \/>\ndoh!  show me the ball!  show me the ball!<br \/>\n&lt;\/blockquote&gt;<br \/>\n&lt;\/p&gt;<br \/>\n<\/code>\n<\/td>\n<\/tr>\n<\/table>\n<p>The only difference between these looks is to do with the use (or not) of <a target=_blank title='Non-breaking space information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Non-breaking_space'><i>non-breaking space<\/i><\/a> (functionality) via the (use of) <a target=_blank href='http:\/\/en.wikipedia.org\/wiki\/Character_encodings_in_HTML' title='HTML entity information from Wikipedia ... thanks'>HTML entity<\/a> <i>&amp;nbsp;<\/i> in the &#8220;Good Look&#8221; version, only &#8230; without resorting to CSS (and only using HTML) and coming across the need to insert a blank line (that takes up space), with the current rendering rules of the web browsers, this is the solution to the problem of lack of whitespace when you need it &#8230; and you guess that if <i>&amp;nbsp;<\/i> has been used a lot and you want less whitespace about, it may be that to substitute the &#8220;<i>&amp;nbsp;<\/i>&#8221; for &#8220;&#8221; solves your problem.<\/p>\n<p>Here is a Wikipedia <a target=_blank title='List of XML and HTML entities at Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/List_of_XML_and_HTML_character_entity_references'>list<\/a> of XML and HTML entities, and we talked a bit about all this with <a target=_blank title='HTML Entities Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=6311'>HTML Entities Primer Tutorial<\/a>.<\/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='#d13412' onclick='var dv=document.getElementById(\"d13412\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=html\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d13412' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Whitespace in HTML can be a very confusing area for web developers, especially when HTML elements float. Even though there are lots of facilities in CSS to overcome the whitespace issues to do with margin, padding and even border (in &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-whitespace-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":[281,446,576,577,842,1319,1425,1467],"class_list":["post-13412","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-css","tag-float","tag-html","tag-html-entities","tag-non-breaking-space","tag-tutorial","tag-whitespace","tag-wysiwyg"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13412"}],"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=13412"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/13412\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=13412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=13412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=13412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}