Created
January 31, 2012 01:57
-
-
Save chriscoyier/1708215 to your computer and use it in GitHub Desktop.
White space and Whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
White space and Whitespace | |
*/ | |
div { | |
margin: 0 0 10px 0; | |
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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. | |
</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> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script> | |
$("#changer").change(function() { | |
$("div").css({ | |
"white-space": $("#changer option:selected").val() | |
}); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split-vertical","prefixfree":"1","page":"html"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment