JSFiddle - React, Tailwind, and code Playground
by Anam Ansari
HTML
<div id="page-wrap">
<label>whitespace</label>
<select id="changer">
<option value="normal">normal</option>
<option value="nowrap">nowrap</option>
<option value="pre">pre</option>
<option value="pre-wrap">pre-wrap</option>
<option value="pre-line">pre-line</option>
</select>
<h2>Actual spaces</h2>
<div class="spaces">
A bunch of words you see.hellooooooooooooooooooooooooooooooooooooooooooooooooooooo hi howwwwwwwwwwwwwwwwwwwwwwwwwww
</div>
<h2>Thin spaces &thinsp;</h2>
<div class="thin-spaces">
A bunch of words you see.
</div>
<h2>Non breaking spaces &nbsp;</h2>
<div class="non-breaking-spaces">
A bunch of words you see.
</div>
<h2>En spaces &ensp;</h2>
<div class="en-spaces">
A bunch of words you see.
</div>
<h2>Em spaces &emsp;</h2>
<div class="em-spaces">
A bunch of words you see.
</div>
<h2>Zero width joiner &zwj;</h2>
<div class="zero-width-joiner">
A‍bunch‍of‍words‍you‍see.
</div>
<h2>Zero width non joiner &zwnj;</h2>
<div class="zero-width-non-joiner">
A‌bunch‌of‌words‌you‌see.
</div>
</div>
CSS
* { margin: 0; padding: 0; }
#page-wrap { width: 960px; margin: 80px auto; }
#page-wrap > div {
margin: 50px;
border: 1px solid red;
width: 100px;
}
body {
background: black;
padding: 40px 20px;
color: white;
}
h2 {
font-size: 12px;
margin: 10px 0 0 0;
color: red;
display: none;
}
JavaScript
$("#changer").change(function() {
alert('called');
$("#page-wrap > div").css({
"white-space": $("#changer option:selected").val()
});
});