I'm trying to draw a textarea
with alternate rows and line numbers.
A very simple solution to have line numbers is the following - see here for more details.
textarea {
background: url(http://i.imgur.com/2cOaJ.png);
background-attachment: local;
background-repeat: no-repeat;
padding-left: 35px;
padding-top: 10px;
border-color: #ccc;
}
<textarea rows="10" cols="40"></textarea>
While to have a textarea
with alternate rows is just a simple as
textarea {
background-image: linear-gradient(#F1F1F1 50%, #F9F9F9 50%);
background-size: 100% 4rem;
border: 1px solid #CCC;
width: 100%;
height: 400px;
line-height: 2rem;
margin: 0 auto;
padding: 4px 8px;
}
<textarea rows="10" cols="40"></textarea>
Both solutions works ok, but combining them it's tricky since both makes use of the background
to hack the line numbers and the alternate rows background.