{"id":18143,"date":"2016-10-05T18:23:21","date_gmt":"2016-10-05T18:23:21","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=18143"},"modified":"2016-10-05T18:32:55","modified_gmt":"2016-10-05T18:32:55","slug":"web-design-css-the-white-space-property","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/web-design-css-the-white-space-property\/","title":{"rendered":"Web design:  css:  the white-space property"},"content":{"rendered":"<h1>The tutor shares how to preserve white space on a web page.<\/h1>\n<p>Html doesn&#8217;t always take white space literally:  when you type five spaces, the browser might show only one.<\/p>\n<p>What if you want the browser to render all the white space just as you&#8217;ve typed it?  Perhaps you can use the css <span style=\"font-family:monospace\">white-space<\/span> property.<\/p>\n<p>Both paragraphs, below, are typed with five spaces, then Hello, then five more spaces, then Hello.  Its literal html follows each: <\/p>\n<p>     Hello     Hello<\/p>\n<p style=\"white-space:pre-wrap;color:orange\">&#60;p&#62;     Hello     Hello&#60;\/p&#62;<\/p>\n<p style=\"white-space:pre-wrap\">     Hello     Hello<\/p>\n<p style=\"white-space:pre-wrap;color:orange\">&#60;p style=&#8221;white-space:pre-wrap&#8221;&#62;     Hello     Hello&#60;\/p&#62;<\/p>\n<p>Apparently, with the css white-space property,  &#8220;pre&#8221; means &#8220;preserve&#8221;.  &#8220;pre-wrap&#8221; means that the text will wrap like normal; with just &#8220;pre&#8221;, it won&#8217;t wrap until a line break:<\/p>\n<p style=\"white-space:pre-wrap\">This paragraph is styled with <span style=\"font-family:monospace\">&#8220;white-space:pre-wrap&#8221;<\/span>.  Hence, extra spaces are preserved like these five     , yet the line automatically wraps.  If it were styled with just <span style=\"font-family:monospace\">&#8220;white-space:pre&#8221;<\/span>, it would continue on the same line until encountering a line break.<\/p>\n<p>Neat, eh?<\/p>\n<p>Source:<\/p>\n<p><a href=\"http:\/\/www.w3schools.com\/cssref\/pr_text_white-space.asp\">w3schools.com<\/a><\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The tutor shares how to preserve white space on a web page. Html doesn&#8217;t always take white space literally: when you type five spaces, the browser might show only one. What if you want the browser to render all the &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/web-design-css-the-white-space-property\/\"> <span class=\"screen-reader-text\">Web design:  css:  the white-space property<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1631,837],"tags":[1948,1946,1949,1950,1943,1944,1947],"class_list":["post-18143","post","type-post","status-publish","format-standard","hentry","category-css","category-web-design","tag-css-white-space-property","tag-how-to-keep-white-space-html","tag-how-to-make-all-spaces-show-up-html","tag-how-to-make-all-spaces-show-up-web-page","tag-how-to-make-typed-spaces-show-up-html","tag-how-to-make-typed-spaces-show-up-web-page","tag-how-to-preserve-white-space-html"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/18143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=18143"}],"version-history":[{"count":23,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/18143\/revisions"}],"predecessor-version":[{"id":18166,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/18143\/revisions\/18166"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=18143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=18143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=18143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}