Roland Seuhs
Roland Seuhs

Reputation: 1995

How to set padding-top for textarea placeholder (but not the normal text)

I use a smaller font for the placeholder for input-text and textarea.

The problem is that now the placeholder text in input-text is vertically centered, but the placeholder text in a 1-row textarea is vertically too far on the top.

I tried to use this simple css:

textarea::placeholder
{   padding-top: 6px;
}

but this seems to have no effect at all.

A similar question has as a solution to use a padding for the whole textarea, but in that case the padding for entered text would be wrong because it uses a different font-size as the normal text

Upvotes: 1

Views: 408

Answers (1)

Roland Seuhs
Roland Seuhs

Reputation: 1995

It works by using a value for "line-height", the exact value has to be found by trial/error, though:

textarea::placeholder {line-height:200%;}

Upvotes: 2

Related Questions