Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>text-overflow test case</title>
<style type="text/css">
.test {
font: 1em bold monospace;
background:lightgrey;
color: black;
margin-left:400px;
}
.rtl {
direction:rtl;
}
.ltr {
direction:ltr;
}
.rlo > * {
unicode-bidi: bidi-override; direction: rtl;
}
.lro > * {
unicode-bidi: bidi-override; direction: ltr;
}
.b { border: 1px dashed blue; }
.inline-block {
display:inline-block;
}
.ellipsis {
width:4em;
width:6.5ch;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow:hidden;
}
</style>
<script>
var twoEyes = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAYCAYAAAFy7sgCAAAGsUlEQVRo3u2ZbWwcZxHHf3s%2B7LNbO3ZjXBtowprGODRX0qpNQCjmJKuVKhMl1P2AkCwhFOIKkCBSm9IXavGFKAixIAECwkmWo5MrhRI3Ub40IEwQgp6aIDg3Cd6eEqyIHEteah%2B1E69vhw%2BZtTaX8704ZzkKjHS6271nZ56ZZ%2BY%2F%2F%2BdZKF%2FCwYshx3EkkggLsD1v4FQkEZZYLCbAKyG9%2Ba9EIsG6hnUAf8x74K3aUC3j4%2BM54HcsR2oAIomwZOezkv%2FnSHpYNh%2BNCmAE7xv94zvFdd1bHsjMZmQkPSxAJP%2B%2FfuBLwK54PC7JZFKAVJmzXLBt2w%2FMvcDLwIb8QS8CeJ4nkURYIomw7J%2FYJ8BvSiiXptGGxWds2%2Fa9%2Bnaxh%2BYAD%2Bgt04NDgABTpQY2cvvSFLzw86gWeBVwC8SzlOSv2YeBPfmDBoBHgKmR9LBEEmHZfDTqGykqfkUE0nA78BzQGfSgUeP3wNeTXwXg7MwZDhw4UHL6ra2ti79%2FOvljgG8AZ4H64Lhm4MvAocxsRppGG%2FxcXihlwLI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vAp%2BhDQ2g4F47dUYtlU6obXA54DnVdFLekjUGGifh4AFy7LEdV3xj3X9I66m0QZpGm2QrsOd0j%2B%2BU0bSw5KZzYjrun6HWlAd961i4FfCj0aN1Usau%2Bc1lmuXPFwvAEumUut7tQQvAb%2FXb%2FT0bCAej9cODg7yt%2Bm%2F8q2%2F7OUHZ76PnZ1k2p0mJzlykmPancbOTnL0whHs7CQfb%2B5mx2d3sH79%2BtCRI0c6FeaOr9ICrIQfLvA%2B8BGNXxi4R6HrisJVUWrxAVW2oMFf0Aczim8o3kV6enowDIPjF9%2Fk%2BMU3S3rrjzMMg56eHr%2BxP7qKFbASfojG6kpeDGs1tiW53RxwWT%2Bin5q8w4xpQK5evQpAR30H7ZH2khNvj7TTUd8BgD4rqmu1ZKX8qNeY%2BfHz4zlXDgT5E8tpCTUq7XSBC4Euv8227TV9fX1E73%2BYtvo27BmbS9cvFVTY3bSRFza9yOcf6Gfmygy7d%2B%2Fm%2FPnzF4DvrsBLhnJlJfwIKXxv1PheAE4qK6p4H9AGbNKTuhngBPBPXYRe4IemaT5kWZbR19fHNbmGnZ1k4r3U4glDR30Hm5qjbGjsImJEOHbsGHv27JFz5869o0eFq01Jq%2BmHAXwI6FFKagMTgHM7GzFDS%2BoeLSMv7zjzC9x4Y7gxFovVDAwMEI1GaWlpWSzRVCrFwYMH%2FXfxZ4AfAa8B%2F7lDaGg1%2FQgp43lfK0yqtRMuJa3ceKe5DfgYsCYAZ2ngD8CfAkzqTpW7xY%2F%2FSznyX%2FVeUb2kVmX4AAAAAElFTkSuQmCC";
function initIMG() {
var img = document.getElementsByTagName('img');
for (i = 0; i < img.length; ++i)
img[i].setAttribute('src', twoEyes);
}
function setTextOverflow(str,quoted) {
var x = document.styleSheets[0];
var q = quoted ? '"' : '';
x.insertRule('.ellipsis{text-overflow:' + q + str + q +'}', x.cssRules.length);
}
</script>
</head><body onload="initIMG()">
text-overflow:"<input placeholder="type text then <ENTER>" onchange='setTextOverflow(this.value,1)'>" | <button onclick="setTextOverflow('ellipsis')">ellipsis</button> | <button onclick="setTextOverflow('clip')">clip</button> (Try "." or "" for example) <br>
LTR / LTR
<div class="test ltr">
<span class="ellipsis b inline-block">CSS is awesome</span>
<button class="ellipsis">CSS is awesome</button>
<input type=button class="ellipsis" value="CSS is awesome">
<input class="ellipsis" value="CSS is awesome">
<input class="ellipsis" placeholder="CSS is awesome">
<fieldset style="display:inline" class="ellipsis"><span style="position:relative;left:1em;">CSS is awesome</span></fieldset>
<fieldset style="display:block" class="ellipsis"><span style="position:relative;left:1em;">CSS is awesome</span></fieldset>
<legend class="ellipsis">CSS is awesome</legend>
<textarea class="ellipsis" style="overflow:scroll;width:14em;" wrap="off">
CSS is awesome CSS is awesome CSS is awesome
CSS is awesome CSS is awesome CSS is awesome
</textarea>
<fieldset style="display:inline"><legend class="ellipsis">CSS is awesome</legend>CSS is awesome</fieldset>
<fieldset style="display:block" class="ellipsis"><legend class="ellipsis">CSS is awesome</legend><span style="position:relative;left:1em;">CSS is awesome</span></fieldset>
<select class="ellipsis"><option>CSS is awesome<option>CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select size="4"><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<ul style="float:left"><li class="ellipsis b">CSS is awesome</ul>
<br><br></div>
RTL / LTR
<div class="test rtl">
<span class="ellipsis b inline-block">CSS is awesome</span>
<button class="ellipsis">CSS is awesome</button>
<input type=button class="ellipsis" value="CSS is awesome">
<input class="ellipsis" value="CSS is awesome">
<input class="ellipsis" placeholder="CSS is awesome">
<fieldset style="display:inline" class="ellipsis"><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<fieldset style="display:block" class="ellipsis"><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<legend class="ellipsis">CSS is awesome</legend>
<textarea class="ellipsis" style="overflow:scroll;width:14em;" wrap="off">
CSS is awesome CSS is awesome CSS is awesome
CSS is awesome CSS is awesome CSS is awesome
</textarea>
<fieldset style="display:inline"><legend class="ellipsis">CSS is awesome</legend>CSS is awesome</fieldset>
<fieldset style="display:block" class="ellipsis"><legend class="ellipsis">CSS is awesome</legend><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<select class="ellipsis"><option>CSS is awesome<option>CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select size="4"><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<ul style="float:left"><li class="ellipsis b">CSS is awesome</ul>
<br><br></div>
LTR / RTL
<div class="test ltr rlo">
<span class="ellipsis b inline-block">CSS is awesome</span>
<button class="ellipsis">CSS is awesome</button>
<input type=button class="ellipsis" value="CSS is awesome">
<input class="ellipsis" value="CSS is awesome">
<input class="ellipsis" placeholder="CSS is awesome">
<fieldset style="display:inline" class="ellipsis"><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<fieldset style="display:block" class="ellipsis"><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<legend class="ellipsis">CSS is awesome</legend>
<textarea class="ellipsis" style="overflow:scroll;width:14em;" wrap="off">
CSS is awesome CSS is awesome CSS is awesome
CSS is awesome CSS is awesome CSS is awesome
</textarea>
<fieldset style="display:inline"><legend class="ellipsis">CSS is awesome</legend>CSS is awesome</fieldset>
<fieldset style="display:block" class="ellipsis"><legend class="ellipsis">CSS is awesome</legend><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<select class="ellipsis"><option>CSS is awesome<option>CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select size="4"><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<ul style="float:left"><li class="ellipsis b">CSS is awesome</ul>
<br><br></div>
RTL / RTL
<div class="test rtl rlo">
<span class="ellipsis b inline-block">CSS is awesome</span>
<button class="ellipsis">CSS is awesome</button>
<input type=button class="ellipsis" value="CSS is awesome">
<input class="ellipsis" value="CSS is awesome">
<input class="ellipsis" placeholder="CSS is awesome">
<fieldset style="display:inline" class="ellipsis"><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<fieldset style="display:block" class="ellipsis"><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<legend class="ellipsis">CSS is awesome</legend>
<textarea class="ellipsis" style="overflow:scroll;width:14em;" wrap="off">
CSS is awesome CSS is awesome CSS is awesome
CSS is awesome CSS is awesome CSS is awesome
</textarea>
<fieldset style="display:inline"><legend class="ellipsis">CSS is awesome</legend>CSS is awesome</fieldset>
<fieldset style="display:block" class="ellipsis"><legend class="ellipsis">CSS is awesome</legend><span style="position:relative;right:1em;">CSS is awesome</span></fieldset>
<select class="ellipsis"><option>CSS is awesome<option>CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<select size="4"><option>CSS is awesome<option class="ellipsis">CSS is awesome<option>CSS is awesome<option>CSS is awesome</select>
<ul style="float:left"><li class="ellipsis b">CSS is awesome</ul>
<br><br></div>
</body></html>