Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(css): update opacity example from ::placeholder #37480

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

OnkarRuikar
Copy link
Contributor

Now, it's about the opacity of the text color and not the element's background, so the opacity property shouldn't be used in the example.

Let's explain the opacity of the color and default color separately.

@OnkarRuikar OnkarRuikar requested a review from a team as a code owner January 3, 2025 07:37
@OnkarRuikar OnkarRuikar requested review from estelle and removed request for a team January 3, 2025 07:37
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed labels Jan 3, 2025
Copy link
Contributor

github-actions bot commented Jan 3, 2025

Preview URLs

Flaws (48)

URL: /en-US/docs/Web/CSS/::placeholder
Title: ::placeholder
Flaw count: 48

  • macros:
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn/CSS
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn/Getting_started_with_the_web/CSS_basics
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn/CSS/First_steps
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn/CSS/First_steps/What_is_CSS
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn/CSS/First_steps/Getting_started
    • and 43 more flaws omitted

(comment last updated: 2025-01-03 07:44:14)

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add a third placeholder example instead of requiring un-commenting.

The inputs should have a <label>

{{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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> 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.

<input placeholder="Default opacity" />
<input placeholder="Full opacity" class="force-opaque" />
<input placeholder="Color set by browser" />
<input placeholder="Same color as input" class="explicit-color" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input placeholder="Same color as input" class="explicit-color" />
<input placeholder="Same color as input" class="explicit-color" />
<input placeholder="Semi-opaque text color" class="opacity-change" />

Comment on lines +122 to +124

/* less opaque text */
/* color: color-mix(in srgb, currentColor 70%, transparent); */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outdated info about Firefox using opacity for placeholders
2 participants