Wells-it.com - Web Hosting

spacing text

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 20 posts

Joined: Jan 2007

how do i make more than one space in text in a webpage?
pressing more than one spacebar just doesnt work!

Greg K's picture
Moderator

He has: 1,665 posts

Joined: Nov 2003

What you need is a "Non-Breaking Space", in actual HTML code, it is represented by   In a WYSIWYG editor like dreamweaver, there is usually a key combination that will insert one for you, I think it is CTRL-SPACE.

-Greg

[This space intentionally left blank]

Cool Geek Supplies: www.ThinkGeek.com

He has: 339 posts

Joined: May 2007

Multiple spaces, line-ends, and tabs normally collapse to a single space in HTML. You can prevent that by using the PRE element, or by declaring "white-space: pre;" in CSS.

If you just want to increase word spacing in a group of words, use the "word-spacing" property in CSS for better control of the amount of space added.

Cordially, David

Cordially, David
--
"Old web developers don't die, they degrade gracefully..."

brady.k's picture

He has: 1,383 posts

Joined: Feb 2002

When you want a space you can do this:

<p>Here's some text...and some more.  But NOW here's two&nbsp;&nbsp; spaces!</p>

'

The   character is literally a space. Any number you want, just use the   as a spacebar-hit.

Kyle Brady, President, Intuitive Industries LLC.
http://www.int-ind.com
[EMAIL=brady.k@gmail.com]brady.k@gmail.com[/EMAIL] - [EMAIL=brady.kyle@int-ind.com]brady.kyle@int-ind.com[/EMAIL]

Megan's picture
Administrator

She has: 10,288 posts

Joined: Jun 1999

Why are you trying to insert an extra space? All of the above answers are good ones, but I'm thinking from a semantic perspective. What's the purpose of the nbsp? I don't really think there are a lot of reasons for using nbsp's but we might be able to think of some. If it's a presentational issue then it should be handled using CSS. If it's because you were taught to type with two spaces after a period, then you should try to unlearn that habit (it's a hold over from old typewriters and isn't necessary anymore).

David - does word-spacing actually work? I'm going to have to try that out... (I mean, is it supported by browsers)

demonhale's picture

He has: 3,301 posts

Joined: May 2005

It is supported Meg, the same properties as letter-spacing which I seem to use a lot lately... it's at Topic 16.4 here http://www.w3.org/TR/REC-CSS2/text.html

Megan's picture
Administrator

She has: 10,288 posts

Joined: Jun 1999

No, I mean does it actually work in web browsers? supported != part of the w3c spec. I know it's in the spec. Letter-spacing is in there too but isn't supported by browsers

Megan's picture
Administrator

She has: 10,288 posts

Joined: Jun 1999

Well surprise surpirse, they actually do work! And even in IE 6!

demonhale's picture

He has: 3,301 posts

Joined: May 2005

Well I also mean supported in browsers as far as I remember, as in I use it all the time... I think my previous post wasn't clear enough... sorry bout that... The link was suppose to clarify you with it's property...

He has: 339 posts

Joined: May 2007

Thanks for the test page, Megan.

Checking on Win xp pro, your page shows:

Letter-spacing works in IE 5.01 and up; Firefox 2, Opera 9, Netscape 7.2, and Moz 1.7.
Word-spacing works in the above except for IE 5.01 and IE 5.5.

Incidentally, I sometimes use a negative letter-spacing for headings. Depending on the font, it can give a nice effect. Letter-spacing: -1px; is usually enough.

Cordially, David.

Cordially, David
--
"Old web developers don't die, they degrade gracefully..."

Megan's picture
Administrator

She has: 10,288 posts

Joined: Jun 1999

That's a good idea, David! I'll have to try that sometime.