Home > Software design >  right-aligned textarea's cursor placement following whitespace
right-aligned textarea's cursor placement following whitespace

Time:03-29

I have a textarea with right-aligned text, and if the cursor is at the end of a line and whitespace is added, the whitespace shows up as expected, however the cursor remains adjacent to the previous non-whitespace character.

Is there anyway to make the cursor appear after newly entered whitespace in this context (like it does when the textarea is left-aligned)?

textarea {
  text-align: right;
}
<textarea></textarea>

CodePudding user response:

you need to specify white-space inside an element. I.E

textarea {
  text-align: right;
  white-space: nowrap;
}
<textarea></textarea>

CodePudding user response:

I think you're looking for the dir="rtl" attribute:

<textarea dir="rtl"></textarea>

  • Related