View Full Version : Creating blank spaces in between words

05-29-2008, 03:10 PM
Whats the best way of creating space between words in CSS. I know I could create a non breaking space but is there a more standards friendly way of doing this?

05-29-2008, 03:11 PM
btw I don't mean accross a whole paragraph, for example say I have

Today is Thursday <space here> paragraph continues

05-29-2008, 03:14 PM
Do you mean between characters or just words ?

This is for letter spacing...

<style type="text/css">
h1 {letter-spacing: -3px}
h4 {letter-spacing: 0.5cm}

<h1>This is header 1</h1>
<h4>This is header 4</h4>

05-29-2008, 03:15 PM
Sorry... our posts crossed.

Why do you need a space ? Just might help with a solution.


05-29-2008, 05:33 PM
space between two words.

I have an address for example
25 Some Street, and then I have a tel number and i want a large space
between the address and tel number, both on same line obvioulsy.

I could just use a few none break spaces but is there a better way?

05-29-2008, 05:33 PM
Put a tag around the word you want a space on, just for CSS to get something to hook to, and then use left and right margin.
Ugly inline ixample:
<p>The quick brown fox <b style="font-weight: normal; margin-left: 20px; margin-right: 20px;">jumps</b> over the lazy dog</p>

05-29-2008, 05:34 PM
I'm familar with the letter and word space properties but this isn't what I need

05-29-2008, 05:37 PM
Cheers Dom, I thought about this, its just seems more lame than none breaking spaces.

I know we're not supposed to be using HTML to acheive presentational results but its easier in this instance. I don't know what this would do to validation if I use the none breaking spaces.

I might be better sticking with what you say Dom.

05-29-2008, 05:43 PM
It's valid to use non breaking spaces, but then you can't use CSS to change the margins.. so it defeats the separation of content and style.

05-29-2008, 06:39 PM
Only trying to help Ricky ;) Just taking a guess... (sometimes I get lucky)

It is a long winded way the css way isnt it ?
I think the old "white space gif" would be the answer ;) lol.

05-29-2008, 06:50 PM
It's 7 more characters to your markup.. hardly long winded to do it the right way? :) Plus much easier once you need to change something ;)

05-29-2008, 08:26 PM
LOL, I know you're trying to help mate and I appreciate it, I wasn't been funny.

Aye the good old spacer gif.

05-29-2008, 08:27 PM
Its not just the characters Dom, it just seems a bit crappy having to do it like that, it might be just to me I don't know.

05-29-2008, 08:29 PM
I'm still new to doing full layouts in CSS, so many of my sites use Flash.

Its a certain way of working that you have to get your head around.

05-29-2008, 09:10 PM
it might be just to me:mrgreen: I wasn't going to say it but since you did