Check out example codes for "how to trim leading spaces in html using css". It will help you in understanding the concepts better.
Code Example 1
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );
Code Example 2
var str = " Hello World! ";
alert(str.trim());
Code Example 3
var str = " GeeksforGeeks";
print(st);
Code Example 4
<div style="white-space:pre-wrap"> <!-- New Line -->
<!-- 2 space --> This is my text
</div>
Learn ReactJs, React Native from akashmittal.com