Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<title>CSS Text Test: minimum rendered width of tab character</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="reviewer" title="Xidorn Quan" href="https://www.upsuper.org/">
<link rel="match" href="tab-min-rendered-width-1-ref.html">
<meta name="assert" content="If [rendered width of tab would be] less than 0.5ch, then the subsequent tab stop is used instead.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<style>
span { background-color: yellow; display: inline-block; }
/* Using 16px Ahem means that the 'ch' unit will be evenly divisible by 8 (for the 0.125ch
increment used below) without running into floating-point accuracy limitations */
pre { position: absolute; top: 0; font: 16px Ahem; }
tt { font: 16px monospace; }
</style>
</head>
<body>
<pre>
</pre>
<script>
let pre = document.getElementsByTagName("pre")[0];
let test = "";
for (i = 7.0; i <= 8.125; i += 0.125) {
test += `<span style="width:${i}ch"><tt>${i}ch</tt></span>&#9;<tt>foo</tt>\n`;
}
pre.innerHTML = test;
</script>
</body>
</html>