...

View Full Version : How to make spaces?



Mumrik
06-09-2012, 04:56 PM
Hello I have created a small text field container thing. I would like to type one piece of text then make a long space in between the first and last word. In order to do this would I have to use multiple text containers? Because I can't make more than one space after the first written word.

I'm sure you get what I mean, I'm using dreamweaver btw.

badwolf
06-09-2012, 10:40 PM
Have you tried using non breaking spaces? For instance try this



<p>This is my sentence with a big &nbsp;&nbsp;&nbsp; space in it.</p>


use as many &nbsp; you may need.

felgall
06-09-2012, 10:55 PM
Alternatively


<p>This is my sentence with a big <span style="white-space:pre"> </span> space in it.</p>

badwolf
06-09-2012, 11:17 PM
Alternatively


<p>This is my sentence with a big <span style="white-space:pre"> </span> space in it.</p>

Wow thanks felgall! I guess a person really does learn something new everyday. I had no idea there was a definition for white spaces in CSS.

@Mumrik, Actually I would use the span tag that felgall has recommended. That is the more correct way to do this. Although the &nbsp; will give little bumps at a time. Either way is legal. :thumbsup:

felgall
06-09-2012, 11:42 PM
Both ways have their uses. When you know both you can use the more appropriate one in each situation.

Will Bontrager
06-10-2012, 03:32 PM
And still one more way :)


A wide <span style="padding-left:150px;">space</span> within.

Will

felgall
06-10-2012, 10:44 PM
And still one more way :)


A wide <span style="padding-left:150px;">space</span> within.

Will

That way is actually adding padding rather than spaces and so you can't specify the number of spaces that is supposed to be there using that method. It is therefore not usable for adding a specific number of spaces between elements in the page the way the other two methods do.

You might insert whitespace into the text that way by specifying the size in em so that the spacing remains proportional to the text but there'd never be any use for using px there (you should only ever use px for border widths).

<span style="padding-left:5em;"> and &emsp;&emsp;&emsp;&emsp;&emsp; would be equivalent provided that it and the following word are within the one line - they would behave differently if the browser decided to start a new line in between or after the spaces (using the padding option is the way to keep those spaces together with the following text). The browser can start a new line between &emsp; whereas it can't between &nbsp;

Will Bontrager
06-11-2012, 11:54 AM
You're correct about the spaces, of course, Stephen.

I had noticed the OP asked for "a long space."

Will



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum