1

Maybe somebody can help me with this problem: I'm looking for a javascript-free solution to show lines in a textarea. The accepted answer here does not work for me because it depends on a fixed line-height inside the box.

My textarea looks like this:

textarea{
  line-height: 2em;
}

so an image-only-solution does not work. Is there something, maybe CSS3-related, that could archive that? I've tried

background: url('whitepx.png') repeat left 2em #363636;

but that colors the whole textarea white.


UPDATE

I think I got it. Sorry if I couldn't make my question clear enough.

This is my css finally:

textarea
    {
    width: 100%;
    background-color: #363636;
    border: 1px solid #fff;
    outline: none;
    color: #fff;
    font-size: 14px;
    display: block;
    padding: 0 0 0 1em;
    line-height: 2em;
    font-family: sans-serif;
    resize: none;
    height: 58em;
    width: 530px;
    background-image: -moz-repeating-linear-gradient(#363636, #363636 20%, #fff 22%);
    background-image: -webkit-repeating-linear-gradient(#363636, #363636 20%, #fff 22%);
    background-image: -o-repeating-linear-gradient(#363636, #363636 20%, #fff 22%);
    background-image: -ms-repeating-linear-gradient(#363636, #363636 20%, #fff 22%);
    background-image: repeating-linear-gradient(#363636, #363636 20%, #fff 22%);    
    background-size: 100% 2em;
    background-attachment: local;
}

See this fiddle. Looks good enough to me.

Community
  • 1
  • 1
32bitfloat
  • 751
  • 2
  • 8
  • 21

1 Answers1

0

You can achive by this way

try to give using multiple line box-shadow

check > http://blog.w3conversions.com/2011/09/css3-spread-value-and-box-shadow-on-one-side-only/

Dinesh Kanivu
  • 2,551
  • 1
  • 23
  • 55
  • sorry if I didn't described my problem exactly enough, but that isn't what I was looking for. See my updated question for a solution that seems to work. – 32bitfloat Oct 17 '13 at 20:23