Comments on: ::placeholder https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Fri, 23 Apr 2021 09:28:59 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Remco https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1771118 Fri, 23 Apr 2021 09:28:59 +0000 http://css-tricks.com/?page_id=20834#comment-1771118 In reply to Benson.

Use something like this. The Input itself has 25px font, the placeholder also but is scaled 0.6 and will be 15px. Works in Safari Chrome and Edge Why is this not working in Firefox?

&::placeholder {
font-size: 25px;
letter-spacing: normal;
transform: scale(0.6);
}

]]>
By: Kelsey Waara https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1759912 Tue, 14 Jul 2020 15:51:31 +0000 http://css-tricks.com/?page_id=20834#comment-1759912 Wowwwww thank you, this is exactly what I needed! Thank you so much for explaining the difference between ::placeholder and :placeholder-shown as well!

]]>
By: Mozi-art https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1758986 Mon, 06 Jul 2020 22:03:51 +0000 http://css-tricks.com/?page_id=20834#comment-1758986 In reply to ahmad.

//this would be better in my opinion
::placeholder:read{}
:placeholder:write{}

]]>
By: Jass https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1753777 Sun, 19 Jan 2020 10:35:28 +0000 http://css-tricks.com/?page_id=20834#comment-1753777 In reply to hoal.

@Mohit Pilania text-align is not supported by all browsers.
Instead:

:root {
  /* Magic numbers! Set them to another value if you like. */
  --w: 30px
  --h: 30px
}
/* You'll need to create container of the #comments-form-email, so that text-align: left = text-align: right */
#comments-form-email-container {
  width: calc(var(--w) + 2px);
  height: calc(var(--h) + 2px);
}
#comments-form-email {
  width: var(--w);
  height: var(--h);
  text-align: right; /* This will also set the text-align of your #comments-form-email, but since this element is wrapped by a container with the same width and height, so it should be fine. */
#comments-form-email:focus {
  text-align: left; /* Usually when you focus on something, it means you're ready to type, so when you focus on #comments-form-email, it's placeholder will disappear, so you'll set it's text-align back to default (which is left). */
}
]]>
By: bech https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1639408 Mon, 18 Jun 2018 09:41:13 +0000 http://css-tricks.com/?page_id=20834#comment-1639408 In reply to Ruslan.

Thanks! I’ve been struggling with this for days. You just cured my headache.

]]>
By: yussan https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1612781 Wed, 01 Nov 2017 12:44:54 +0000 http://css-tricks.com/?page_id=20834#comment-1612781 i love this selector, make my input style more cool

]]>
By: Adam Clark https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1611651 Thu, 07 Sep 2017 09:07:05 +0000 http://css-tricks.com/?page_id=20834#comment-1611651 In reply to Soorajlal.

Nice. But would it be okay to remove the element qualifier from these declarations? If not they’ll only be applied to input tags and not, for example, textarea tags.

]]>
By: Lori https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1611634 Wed, 06 Sep 2017 13:42:33 +0000 http://css-tricks.com/?page_id=20834#comment-1611634 In reply to Ruslan.

Thanks Ruslan!

]]>
By: Soorajlal https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1611177 Fri, 18 Aug 2017 04:39:52 +0000 http://css-tricks.com/?page_id=20834#comment-1611177 Good Post. Include style for Microsoft Edge browser also.

input::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color:transparent;
}

input:-moz-placeholder { /* Firefox 18- */
color:transparent;
}

input::-moz-placeholder { /* Firefox 19+ */
color:transparent;
}

input:-ms-input-placeholder { /* IE */
color:transparent;
}

input::-ms-input-placeholder { /* IE Edge */
color:transparent;
}
]]>
By: Abdul Haseeb https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1610728 Fri, 28 Jul 2017 05:36:58 +0000 http://css-tricks.com/?page_id=20834#comment-1610728 How to align placeholder in HTML not text.

]]>
By: Ivan https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1610368 Tue, 18 Jul 2017 02:08:45 +0000 http://css-tricks.com/?page_id=20834#comment-1610368 In reply to Ruslan.

It won’t work if you write it all together. I tried it

]]>
By: Falk https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1609524 Sun, 25 Jun 2017 12:17:21 +0000 http://css-tricks.com/?page_id=20834#comment-1609524 In reply to Ralp[h.

Thank you, thats what I looking for

]]>
By: Davide Gelormini https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1608149 Thu, 20 Apr 2017 11:04:46 +0000 http://css-tricks.com/?page_id=20834#comment-1608149 In reply to Håkan Save Hansson.

After 3 year you saved my life ahahah thx man

]]>
By: cmd-R https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1608116 Wed, 19 Apr 2017 14:15:42 +0000 http://css-tricks.com/?page_id=20834#comment-1608116 For me, i’ve had to put “input” in front of all, otherwise it doesn’t work.

]]>
By: Ruslan https://css-tricks.com/almanac/selectors/p/placeholder/#comment-1607694 Tue, 28 Mar 2017 20:28:28 +0000 http://css-tricks.com/?page_id=20834#comment-1607694 Otherwise the declaration will have no effect. Check this example

]]>