JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div>
<p>Foo</p>
<p>The quick brown fox jumps over the lazy dog</p>
<p>Bazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz</p>
</div>
</body>
</html>
CSS
body {
font: 18px sans-serif;
}
div {
position: absolute;
width: 200px;
border: 1px solid;
counter-reset: lines;
overflow-y: hidden;
box-sizing: border-box;
}
p {
margin: 0;
padding: 0.25em 0.5em;
border-bottom: 1px solid rgba(0,0,0,0.2);
box-sizing: border-box;
white-space:pre;
}
p:nth-child(odd) {
color: red;
}
p::before {
counter-increment: lines;
content: counter(lines);
display: inline-block;
min-width: 1.25em;
text-align: right;
margin-right: 0.5em;
}