RivkaS Posted September 23, 2007 Share Posted September 23, 2007 Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the character entity. Could somebody please explain that in other words? Do I need to add this entity by my self or does that happen automatically? Link to comment Share on other sites More sharing options...
boen_robot Posted September 23, 2007 Share Posted September 23, 2007 Could somebody please explain that in other words? Do I need to add this entity by my self or does that happen automatically? If you write more then a single space between characters (letters, symbols), all of those spaces are reduced to a single space when the HTML file is displayed on the browser screen.For example, if you write:some text (8 spaces originally. I'm not sure to how much the forum reduces them to)In an HTML file, on the browser screen you'll see some text (1 space) You need to add it in the HTML file yourself. Without it, space is reduced as shown above. With it, each occurance of & nbsp; will be another space to preserve. So, if you writesome text (8 spaces originally, and one & nbsp; between them)In an HTML file, on the screen you'll see some text (3 spaces. One for all space between "some" and the entity, the entity itself, and one for all space between the entity and "text") Link to comment Share on other sites More sharing options...
mistergalarza Posted September 23, 2007 Share Posted September 23, 2007 Could somebody please explain that in other words? Do I need to add this entity by my self or does that happen automatically? You can't add spaces in code by just pressing the spacebar. HTML will remove the spaces and leave only one, any space after the first one is removed. In order to add spaces if you need them, would be to type in. It is a space equivalent.I believe versions of Dreamweaver add that character, but im not sure, I just use it in code view. I believe in Design view it auto adds the into your code. Link to comment Share on other sites More sharing options...
RivkaS Posted September 23, 2007 Author Share Posted September 23, 2007 You can't add spaces in code by just pressing the spacebar.So I need to insert this into code but not into text that is between tags, correct? Link to comment Share on other sites More sharing options...
mistergalarza Posted September 24, 2007 Share Posted September 24, 2007 So I need to insert this into code but not into text that is between tags, correct?No, between the tags where the text is. Link to comment Share on other sites More sharing options...
RivkaS Posted September 24, 2007 Author Share Posted September 24, 2007 some text some text (3 spaces. One for all space between "some" and the entity, the entity itself, and one for all space between the entity and "text") So a word is a space however long and "nbsp" is a space - but wouldn't that mean that I need to place a nbsp between every two words? Link to comment Share on other sites More sharing options...
boen_robot Posted September 24, 2007 Share Posted September 24, 2007 So a word is a space however long and "nbsp" is a space - but wouldn't that mean that I need to place a nbsp between every two words?No. If you have one space, it's shown as is (as space). It's just that if you have more then one space, it's reduced to one space. You only need to place this entity (nbsp) if you need to have more then one space between two words. Link to comment Share on other sites More sharing options...
RivkaS Posted September 24, 2007 Author Share Posted September 24, 2007 You only need to place this entity (nbsp) if you need to have more then one space between two words.Ahhhhhh... now I understand. Thank you so much Link to comment Share on other sites More sharing options...
murfitUK Posted September 24, 2007 Share Posted September 24, 2007 It is also used to make sure that words are kept together and do not get split at the end of a line. So if you want (for example) to display the name Mr Smith but make sure Mr doesn't appear at the end of a line and Smith at the beginning of the next you would use a nbsp (non-breaking space). <p>... blah ... blah ... blah ... Mr Smith ... blah ... etc</p> Link to comment Share on other sites More sharing options...
RivkaS Posted September 24, 2007 Author Share Posted September 24, 2007 Also a nice tip.Thank you as well Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.