[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do i write blank spaces?

Posted on 2003-11-18
11
Medium Priority
?
505 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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Suggested Courses

831 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