I know modern browsers remove most space chars and ‘ ’; characters insider a paragraph element. But is there a way to get the browser to not remove the space chars?
Maybe a CSS attribute, or HTML doctype to use?
Or maybe my last resort is to use javascript to convert every 4 space characters to tabs?
Example of the text I want to display:
<p>There should be gaps of 4 chars tween each word</p>
If my only resort is Javascript; can you tell me if my regular expression will correctly change any ” ” char(that occurs twice or more) with an “_” char?
var p = document.getElementById("myP");
var con = p.innerHTML;
con = con.replace("[ ]{2,}", "_");
p.innerHTML = con;
Is there any reason using
<pre>tags wouldn’t be suitable for this? Because that’s what it sounds like you need.Output (wrapped your content above in
<pre></pre>tags):Also,
<pre>tags can still be styled.