Browser is replacing Multiple space between words to the single space in html page. for e.g if my text is 'AB-DC 3'
in Browser its showing 'AB-DC 3'
. Inspect window its showing 2 spaces 'AB-DC 3'
.
you can also try out yourself. just inspect element and add multiple spaces in word of any line check.
is there any solution for this?? Similar question answered cause, but not explaining how to resolve this.
Use JavaScript's string. replace() method with a regular expression to remove extra spaces. The dedicated RegEx to match any whitespace character is \s . Expand the whitespace selection from a single space to multiple using the \s+ RegEx.
Hello. Hello. Hello. This is perfectly fine, as if you need multiple spaces of pre-formatted text you can just use the <pre> tag.
Answer: Use the JavaScript replace() method.
Whitespace is non-significant by default, and is compacted down to a single space when rendered.
CSS can change that: white-space: pre-wrap
will provide the default line-wrapping functionality that you would expect, plus the significant-whitespace behaviour of preformatted text. Best of both worlds!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With