?
Solved

How do i write blank spaces?

Posted on 2003-11-18
11
Medium Priority
?
503 Views
Last Modified: 2010-04-09
How do i write blank spaces in HTML?
I know   works but if I want 10 spaces it looks ugly
0
Comment
Question by:PieP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 10

Expert Comment

by:KenAdney
ID: 9773123
Some folks create a gif of the appropriate size & insert that.
0
 
LVL 31

Accepted Solution

by:
seanpowell earned 80 total points
ID: 9773236
THere's a number of ways to handle that - it depends on the situation and the frequency. For simple issues, you can use:

Give me a <span style="width:100px;">&nbsp;</span>really big space.
0
 
LVL 17

Expert Comment

by:dorward
ID: 9773302
The width property doesn't apply to <span> elements (with their default display). A bug in MSIE lets authors get away with it.

There are several techniques which might be considered good, but are dependent on the context.

Why do you want blank spaces? (Show us the data you are trying to layout)
0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
LVL 5

Expert Comment

by:pmsyyz
ID: 9774459
<span style="white-space:pre">          </span>
0
 
LVL 1

Expert Comment

by:cifroes
ID: 9775304
you really should use 10 &nbsp; for what you want, if you want to have a 10 space on the same paragraph or something like that you may use margin-left css property, <blockquote>TEXT</blockquote>, white css borders, etc...
0
 
LVL 4

Expert Comment

by:apprenti
ID: 9775613
&nbsp; is the normal way, or you can use CSS letter-spacing: or word-spacing:
<span style="word-spacing:0.6em">Bonjour Hola! Servus</span>
0
 
LVL 17

Expert Comment

by:dorward
ID: 9776903
* &nbsp; is not something you should use (for this)
* Blockquote is something you certainly should not use unless its a quote
* margin might be apropriate - but it depends on the data that you are trying to lay out
* &nbsp; is only the "normal" way becuse its a quick hack that 'works' in some places.
0
 
LVL 3

Expert Comment

by:monvelasquez
ID: 9776963
you wan use <pre>
ex.
I have 10 spaces after this.<pre>          </pre>. Did you see them?
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9779021
As others have remarked, it really depends upon the context.

Using a div or span purely for the purpose of adding spacing is bad use of markup.

> I know &nbsp; works but if I want 10 spaces it looks ugly

How it looks in source is immaterial.

There are many alternatives -- for instance, if you are wanting to provide indentation of a paragraph, then, yes, inserting ten nonbreaking spaces is quite ugly when you can use something like p { text-indent:3.5em;} instead.

Please tell us precisely what it is you're wanting to do and why.
0
 
LVL 1

Expert Comment

by:cj_nepenthe
ID: 9787139

Hi,

There's loads of ways to do this, the best one depends on where you need the space and why.  Most of the options have already been covered, but I'll just add one more.  To add 10 characters worth of spacing after some text, try this:

<span style="margin-right:10em">
This text has 10 chars of spacing to the right
</span>
This text appears after the spacing.

Good luck!
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9791390
Thanks - glad to help.
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question