HTML distinguishes a single standard spacemultiple spaces are not recognized. A special character called a nonbreaking space can be used when you need to create a space between two words that should not be split as a result of a text wrap. A nonbreaking space will prevent a line break from occurring at the point where it is insertedthe content before and after the special space will be constrained to the same line. The location where the line break happens in a block of text as a result of text wrap on a Web page can vary greatly depending on many factors, including font size and the size of the visitor's browser window. Using a regular space between "Yoga" and "Sangha," for instance, might result in the word "Yoga" appearing at the end of a line and the word "Sangha" appearing at the beginning of the next line. Using the nonbreaking space would force the browser to keep these two words together. The nonbreaking space has been used to create the effect of multiple spaces because you can insert more than one space consecutively. You can also insert nonbreaking spaces at the beginning of a line of text, whereas you can't begin a line with a standard space. However, it is best to use other methods to control the layout such as creating first line indents with CSS. Nonbreaking spaces are best used any time you need to insert a space between characters, words, or other elements that should not be separated, such as mathematical equations, names and their suffixes, and dates.
Notice how the words are kept to the same linethe break occurs either before or after, but not where the nonbreaking space is located. Note Previewing Dreamweaver documents in browsers was covered in Lesson 1. |