Reputation: 2019
I want to use a tab space in my string. I am providing the code of using new line. But I don't know how to use a tab space in a string. Can anyone help me on this !?
"Warning ! Sorry Cash Pay is less than this <br/> month\'s installment. Please pay the <br/> right amount."
Upvotes: 5
Views: 31656
Reputation: 1218
If you want to add a single space, Type
If you want to add 2 spaces, Type  
If you want to add 4 spaces, Type  
(4 spaces is a tab
space)
Upvotes: 0
Reputation: 41
You can also use  
(non-breaking spaces) for making white spaces in HTML lines.
"Warning ! Sorry Cash Pay is less than this month\'s installment. Please pay the right amount."
Upvotes: 0
Reputation: 519
If you put your string in an HTML <pre>
element then it can have a tab character. String "Warning! \t error"
set to be put into the innerHTML of <pre id="output"></pre>
will result in
:Warning! error
.
See also:
https://stackoverflow.com/questions/4631646/how-to-preserve-whitespace-indentation-of-text-enclosed-in-html-pre-tags-exclu
Upvotes: 0
Reputation: 57650
	
is TAB character in ASCII. But according to html spec all white space characters will be stripped to a single character. There are other white space characters too. Like  
,  
and  
You can try them too.
It seems  
gives a spacing of tab size. See the following
a b
rendered as a ba b
rendered as a ba b
rendered as a ba b
rendered as a ba	b
rendered as a bUpvotes: 17