?
Solved

How do i write blank spaces?

Posted on 2003-11-18
11
Medium Priority
?
504 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
Independent Software Vendors: 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

Industry Leaders: 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!

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

649 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