-1

is there a way to do a text indent inside an input box such that the text is halfway in the box but offset to the left by 20 pixels?

.my-input {
    text-indent: calc(50%-20px);
}

Getting an error

text indent calculation

user3226932
  • 2,042
  • 6
  • 39
  • 76

1 Answers1

2

Your only mistake is that you forgot to separate the operation with spaces inside the calc() function. Changing it into this made it work.

.my-input {
    text-indent: calc(50% - 20px);
}
Yoshi
  • 172
  • 7