Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find input placeholder style

Tags:

html

css

Couldn't find default placeholder style for input element. There are no any webkit-input-placeholder, -moz-placeholder, -moz-placeholder, or -ms-input-placeholder style settings in any css files.

UPDATE: Guys, don't hurry to judge me. I have the legacy code (tones of css files). The one placeholder style (font-weight, color and so on) is not properly shown in IE 11. I started to find where the placeholder style is defined. And I didn't find any placeholder style declaration you all mentioned.
So I assume there is a default style for placeholder in browser.

like image 745
Lesha Pipiev Avatar asked Jul 18 '16 11:07

Lesha Pipiev


People also ask

How do you select placeholder style?

The ::placeholder selector selects form elements with placeholder text, and let you style the placeholder text. The placeholder text is set with the placeholder attribute, which specifies a hint that describes the expected value of an input field.

How do you find the placeholder style in inspect element?

Check the "Show user agent shadow DOM" checkbox and reload your page. You should now see the placeholder html output in your dev tools when you view the elements tab. Clicking on the placeholder html will bring up the applied styles for you to view or edit.

How do I change placeholder in CSS?

Change Input Placeholder Text with CSS You can use the ::placeholder pseudo-element to change the styles of the placeholder text, which includes the ability to change the background. The code in this example uses a Sass function to generate code for support in older browsers as well.

Where is placeholder in HTML?

Definition and Usage The short hint is displayed in the input field before the user enters a value. Note: The placeholder attribute works with the following input types: text, search, url, tel, email, and password.


1 Answers

Webkit's User Agent Stylesheet (Chrome & Safari) can be found here: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css

Their CSS shows:

::placeholder {
  -webkit-text-security: none;
   color: darkGray;
  pointer-events: none !important;
}

input::placeholder, isindex::placeholder {
  white-space: pre;
  word-wrap: normal;
  overflow: hidden;
}

I can't find any other sources that have the defaults for other browsers, but I imagine they would be close to this.

like image 59
skyline3000 Avatar answered Sep 29 '22 11:09

skyline3000