Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Estelle Weyl <[email protected]>
  • Loading branch information
OnkarRuikar and estelle authored Jan 7, 2025
1 parent deacb5c commit 23f6f50
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions files/en-us/web/css/_doublecolon_placeholder/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Some browsers make placeholder text less opaque. If you want fully opaque text,
```html
<input placeholder="Color set by browser" />
<input placeholder="Same color as input" class="explicit-color" />
<input placeholder="Semi-opaque text color" class="opacity-change" />
```

#### CSS
Expand All @@ -119,9 +120,11 @@ input {
.explicit-color::placeholder {
/* use the same color as input element to avoid the browser set default color */
color: currentColor;
}

.opacity-change::placeholder {
/* less opaque text */
/* color: color-mix(in srgb, currentColor 70%, transparent); */
color: color-mix(in srgb, currentColor 70%, transparent);
}
```

Expand All @@ -130,7 +133,7 @@ input {
{{EmbedLiveSample("default_color", 200, 60)}}

> [!NOTE]
> Note that browsers use different default colors for placeholder text. For example, Firefox uses the input element's color with 54% opacity, and Chrome uses `darkgray` color. If you want consistent placeholder text color across the browsers, then set the color explicitly.
> Note that browsers use different default colors for placeholder text. For example, Firefox uses the input element's color with 54% opacity, and Chrome uses `darkgray` color. If you want consistent placeholder text color across the browsers, then set the `color` explicitly.
## Specifications

Expand Down

0 comments on commit 23f6f50

Please sign in to comment.