Solved

How do i write blank spaces?

Posted on 2003-11-18
11
496 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 20 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
CSS/audio questions 2 48
html select on change 3 25
Centering a div in html5 5 47
html input clean up 3 32
Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now