Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling input placeholder CSS within dev tools

I know how to style the CSS of placeholder text/background/font-size etc across browsers with each browser's specified pseudo classes. However I cannot style them within the browser with dev tools and have not found an answer to whether this is even possible.

I'd love to work with placeholder styles without a trial and error workflow.

like image 348
Ben Racicot Avatar asked Oct 13 '14 15:10

Ben Racicot


People also ask

How do you style a placeholder in CSS?

Use the ::placeholder pseudo-element to style your placeholder text in an <input> or <textarea> form element. Most modern browsers support this, but for older browsers, vendor prefixes will be required.

How do I change placeholder position in CSS?

In most of the browsers, placeholder texts are usually aligned in left. The selector uses text-align property to set the text alignment in the placeholder.

Can I use CSS input placeholder?

Only the subset of CSS properties that apply to the ::first-line pseudo-element can be used in a rule using ::placeholder in its selector. Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default.

How do I inspect placeholder in Chrome CSS?

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.


1 Answers

It is possible in Chrome.

Go to the Dev Tools Settings (the gear icon in the top right) and under General|Elements turn on "Show user agent shadow DOM".

Chrome Settings

Now go inspect your text box. There should now be an arrow next to the input element.

Expand that and select <div psuedo="-webkit-input-placeholder" id="placeholder" style="visibility: visible; text-overflow: clip;">.

Your classes that you are using to modify the placeholder should show up in the style pane.

Here is what it should look like:

enter image description here

like image 66
quw Avatar answered Oct 14 '22 09:10

quw