When creating a textarea
with a horizontal scrollbar, how to enable a padding on the right side?
CSS padding
works for the top right corner, but not for the right side:
textarea {
white-space: pre;
overflow-wrap: normal;
overflow-x: scroll;
border: 1px solid black;
height: 5rem;
width: 14rem;
padding: 0.75rem;
}
<textarea>foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar</textarea>
2
Answers
Interesting issue. I would use a content editable div.
This seems to be a known bug (Issue #40572939) specifically for textarea and have been staying open without any fix for a while in Chromium. As quoted in the issue:
For now the only solution I know all involves changing the
textarea
to acontenteditable
similar to what @spyder1329 posted.