Thursday, November 05, 2009

&;nbsp and how to display HTML code: Notes from an HTML 'need-to-know-only' non-geek

In a previous post I copied a lot of text from a US government RFA (Request for Applications).  While trying to get it to look right, I noticed in the Edit HTML mode that it had paragraphs made up of  only "&;nbsp".

I would call myself a 'need-to-know' html non-geek.  I'd love to understand all the html, but I'd also like to speak fluent Mandarin and a lot of other things.  So, as a blogger I've gotten to know some html by necessity.  Sort of like learning 'hello,' 'thank you,' 'how much?,' 'where's the bathroom?' and a few other phrases you'll need while traveling in a country for just a week or two.

When I started blogging three years ago plus, in the Safari version of Blogger, I had to add links by using the html code; it wasn't a click on the toolbar.  Blogger has made all these things simpler, but there are still times when I want to tweek something and Compose just won't do.  Generally I've been able to google what I wanted to know, say, "Email link html" and get the answer.

I even wrote a blog post on basic html for non-coding bloggers.  But I never posted it because I couldn't figure out how to post the code without blogger reading it as code.

[As it turns out, I had the same problem with this post.  All the "&;nbsp" disappeared when I looked at the post in Preview.  So I googled "How to show HTML on a page."  - Why didn't I do that last time?  I must have but didn't get good answers. -  But this time I got a great site which allows you to put your code into one box and in a second box it gives you the code converted so you can display the code without the browser reading it as code.  Go to Felgall.com.  This is far more significant than the original point of this post, which was really blogger trivia.]

In any case, out of curiosity, I googled "&;nbsp  html" and got this very informative site which said this is a way to make spaces and indents.  Early on I had looked for ways to make spaces in html but I never found this solution.  This is a real pain in the neck on blogger.   Basically I was told by every site to make a table.  So this is interesting.  Especially the part that says that some browsers won't read this as an indent or space. 

From sightspecific.com

What is &;nbsp? Is it needed?

Short Answer

 &;nbsp is the entity used to represent a non-breaking space. It is essentially a standard space, the primary difference being that a browser should not break (or wrap) a line of text at the point that this   occupies.

Long Answer

&;nbsp is the entity used to represent a non-breaking space. It is essentially a standard space, the primary difference being that a browser should not break (or wrap) a line of text at the point that this   occupies.
Many WYSIWYG HTML editors insert these   entities in an effort to control the layout of the HTML document. For example, such an editor may use a series of non-breaking spaces to indent a paragraph like this:
&;nbsp &;nbsp &;nbsp This first line of text is supposed to be indented. However, many browsers will not render it as intended.
As the example mentions, some browsers will not, in fact, indent the text because of how that particular browser handles the &n*bsp; entity. . .  [go to the link for the whole explanation]
So now I know.  I'm not sure I want to use &;nbsp to make spaces because it sounds like it will look funny on some browsers.  But I can go back and resurrect the old post I started on simple html for non-geek bloggers.

[Update:  When I looked at this in Preview, the symbol worked in the Title, but not in the post itself.  So I didn't fix the title.  But I see that in the title it got read as code and just indented the title a space.  So I've (I hope) fixed it now.]

2 comments:

  1. Way back when, about 16 years ago, I put up a web page featuring the landscaping my husband and I did from the ground up on about 1 acre of our 5 acre rural/semi-suburban piece of land.

    That was just before all the fancy software came out with HTML for Dummies and the like, so I put together my web pages with Notepad and basic HTML.

    That web site disappeared into the ether when we moved down to Oregon, but...

    I can still embed a link to another web page without looking up the HTML!

    ReplyDelete
  2. Try this (for offline use)--
    http://www.danish-shareware.dk/soft/shtmlc/

    It's free and converts what's on the clipboard

    [or use WordPress.com ;) ]

    ReplyDelete

Comments will be reviewed, not for content (except ads), but for style. Comments with personal insults, rambling tirades, and significant repetition will be deleted. Ads disguised as comments, unless closely related to the post and of value to readers (my call) will be deleted. Click here to learn to put links in your comment.