HTML question

Joined
Sep 10, 2005
Messages
764
I'm just playing around with HTML like a typical newbie, and can't figure out what &nbsp does. Google pages adds it to everything, and I'm wondering why. Here is an example of a blank field on Google's Page Creator tool:

<p>&nbsp;</p>

What in the world does that do? :) Thanks.
 
&nbsp is a nonbreaking space. It just injects a single blank space without going to a new line.
 
BillLeeLee said:
&nbsp is a nonbreaking space. It just injects a single blank space without going to a new line.
true, but it's a little more detailed than that.

Normally, when a browser renders a page, it tokenizes the page based on words in the content. Therefore, if you have two spaces one after another (like is common when starting a new sentence after a punctuation mark), the browser will see the two spaces and, since it is tokenizing, it will reduce that to a single space. The same is true a of a TAB. Therefore, the &nbsp is used to tell the browser that you want a space to be included and to not allow that space to be reduced out by the tokenizer.

since the &nbsp is not a plain-ole-blank-space (that is, it's a word because it's written out as text), it gets around the tokenizer and there is code in the browser's rendering engine that knows that when it sees &nbsp, it needs to insert a blank space. In this regard, a space is treated as a common HTML special symbol. A list of the other special characters can be found here
 
Thanks! That was very helpful, and the site is even more helpful. I have one more question, however, and I think it best to keep it in one thread:

I'm creating a form on my website for the user to complete and then press the submit button. I need to get the information from the submit button -- how do I do that using HTML? It would be nice if the information in the form is sent to me in an e-mail. Here is the current HTML, it is for a custom system build estimate:
Code:
<form id="customPcForm" name="customPcForm" method="post" action=""> <label> <input name="title" value="radiobutton" type="radio"> Mr <input name="title" value="radiobutton" type="radio"> Mrs <input name="title" value="radiobutton" type="radio"> Ms<strong><br> Name:</strong> <input name="nameField" id="nameField" size="40" type="text"> <strong><br> <br> Location: </strong> <textarea name="textarea" cols="50" rows="3"></textarea> <br> <br> <strong>Contact Info </strong><br> How may I contact you? (select and fill all that apply)<br> <input name="checkbox10" value="checkbox" type="checkbox"> E-Mail:<br> <input name="textfield2" size="30" type="text"> <br> <input name="checkbox11" value="checkbox" type="checkbox"> Phone:<br> <input name="textfield3" size="30" type="text"> <br> <input name="checkbox12" value="checkbox" type="checkbox"> AIM IM:<br> <input name="textfield4" size="30" type="text"> <br> <input name="checkbox13" value="checkbox" type="checkbox"> MSN IM:<br> <input name="textfield5" size="30" type="text"> <br> <input name="checkbox14" value="checkbox" type="checkbox"> IRC IM:<br> <input name="textfield6" size="30" type="text"> <br> <input name="checkbox15" value="checkbox" type="checkbox"> Yahoo! IM:<br> <input name="textfield7" size="30" type="text"> <br> <br> <strong>Computer Experience / Knowledge <br> </strong>Please check the level of computer experience you feel best represents yourself: <br> <input name="checkbox20" value="checkbox" type="checkbox"> Well above average <br> <input name="checkbox21" value="checkbox" type="checkbox"> Above average<br> <input name="checkbox22" value="checkbox" type="checkbox"> Average<br> <input name="checkbox23" value="checkbox" type="checkbox"> Below Average<br> <input name="checkbox24" value="checkbox" type="checkbox"> Well below average <br> <br> <strong>Type of computer<br> </strong>Select the type of computer you wish to purchase:<br> <input name="checkbox26" value="checkbox" type="checkbox"> Graphics / Video editing<br> <input name="checkbox27" value="checkbox" type="checkbox"> High-performance gaming machine <br> <input name="checkbox28" value="checkbox" type="checkbox"> Server<br> <input name="checkbox29" value="checkbox" type="checkbox"> Typical home PC <br> <strong><br> Components / Software</strong> <br> Which of the following do you plan to purchase along with the new pc?<br> <input name="checkbox" value="checkbox" type="checkbox"> Monitor<br> <input name="checkbox2" value="checkbox" type="checkbox"> Speakers / Headphones <br> <input name="checkbox3" value="checkbox" type="checkbox"> Keyboard and mouse <br> <input name="checkbox4" value="checkbox" type="checkbox"> Microphone<br> <input name="checkbox5" value="checkbox" type="checkbox"> Webcam<br> <input name="checkbox25" value="checkbox" type="checkbox"> Wireless / wired router <br> <input name="checkbox7" value="checkbox" type="checkbox"> Microsoft Office 2003<br> <input name="checkbox8" value="checkbox" type="checkbox"> Macromedia Studio 8 <br> <input name="checkbox6" value="checkbox" type="checkbox"> Operating system<br> If checked, please select operating system:<br> <select name="select" size="4"> <option>Windows XP Pro</option> <option>Windows XP Home</option> <option>Windows 2003 Server Ed.</option> <option>Linux</option> </select> <br> <input name="checkbox9" value="checkbox" type="checkbox"> Other - please explain below<br> <input name="textfield" size="52" type="text"> <br> <input name="checkbox19" value="checkbox" type="checkbox"> Unsure / Undecided <br> <br> <strong>Delivery<br> </strong>Select preferred delivery method:<br> <input name="checkbox16" value="checkbox" type="checkbox"> Home Installation (I install everything) <br> <input name="checkbox17" value="checkbox" type="checkbox"> Shipped (United Postal Service)<br> <input name="checkbox18" value="checkbox" type="checkbox"> Local pick-up <br> <strong><br> Intended Use<br> </strong>How do you plan to use this system? <br> <br> <textarea name="intendedUse" cols="50" rows="4" id="intendedUse"></textarea> <br> <br> <strong>Target Budget </strong><br> How much do you plan to spend on this system? <br> <br> </label> 
<p> <label> <textarea name="targetBudget" cols="50" rows="3" id="targetBudget"></textarea> </label> </p>

I know that's a lot of code as it contains the entire form. :) I created the form in Dreamweaver originally then copied the appropriate (I think) code to Google Pages. You can view the actual unfinished but published page here. Thanks again.
 
WHOA, PARTNER! You need to learn how to use the <CODE> tags in VBulletin.
 
<form method="post" action="mailto:[email protected]" enctype="text/plain">> - note this is unreliable as it uses the systems default mail application which is not always configured correctly. Alternatives to mailing are server side cgi apps or server side preprocessors like php or asp.

use square brackets for code [ c o d e ] he if put the correct brackets it would be processed by the forum
 
Lord of Shadows said:
<form method="post" action="mailto:[email protected]"> - note this is unreliable as it uses the systems default mail application which is not always configured correctly. Alternatives to mailing are server side cgi apps or server side preprocessors like php or asp.

use square brackets for code [ c o d e ] he if put the correct brackets it would be processed by the forum
This is unreliable because it uses my system's default mail application? Is it even possible to set my mail application to gmail.com ? All I have seen in windows was like hotmail and outlook express.
 
jesusfr3ak4evr said:
Excellent! Very helpful article... I'll see if I can find a free CGI script server site.

I'll probably use http://www.hostedscripts.com/

No more time to work on it tonight, however.

Those scripts aren;t compatible with Google Pages, if that's what you're planning on using. You'll either have to settle for the mailto method or find a more sophisticated hosting provider.
 
Back
Top