Solved

How do i write blank spaces?

Posted on 2003-11-18
11
502 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 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

717 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