Reputation: 87
I have created a table and want to add a multi space text to it. Ex: HELLO<1stSPACE><2ndSPACE>WORLD. If i add as HELLO WORLD, then its printing with single space.
Any help?
<th width="6%" class="textLeft width100px borderTopNone" style="vertical-align:top;font-size:14px; white-space: nowrap;" colspan="2">HELLO WORLD</th>
Thanks
Upvotes: 1
Views: 81
Reputation: 1067
Before your text use <pre>
tag. <pre>
tag renders text in the format you type. But simple html tags removes extra spaces. Or even simpler, use  
instead of your spaces.
<th width="6%" class="textLeft width100px borderTopNone" style="vertical-align:top;font-size:14px; white-space: nowrap;" colspan="2">
HELLO  WORLD
</th>
Or :
<th width="6%" class="textLeft width100px borderTopNone" style="vertical-align:top;font-size:14px; white-space: nowrap;" colspan="2">
<pre>HELLO WORLD</pre>
</th>
Upvotes: 1
Reputation: 4648
You can use the word-spacing
CSS property, for example:
word-spacing: 1em;
Read more here:
Here's an example on jsfiddle - the second table cell has extra spacing.
You can also use white-space: pre
as suggested by others but it might not work in older IEs. And I can see you already set white-space
to nowrap
.
Or you can use
to hard-code the space but it's usually better to use CSS.
Upvotes: 1
Reputation: 10216
You can use the
character entity as non breaking space - DEMO
- A common character entity used in HTML is the non breaking space.
HTML:
<th width="6%" class="textLeft width100px borderTopNone" style="vertical-align:top;font-size:14px; white-space: nowrap;" colspan="2">HELLO WORLD</th>
Upvotes: 1