splitforms.com

HTML · INPUT ATTRIBUTE

HTML placeholder attribute: examples, styling and accessibility

Last reviewed

The placeholder attribute shows a short hint inside an empty text-like <input> or <textarea>. It disappears as soon as the visitor types, it is not sent with the form, and it doesn't replace a visible label.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

placeholder-example.html
<input type="email" name="email" placeholder="you@example.com">

Copy-paste code

HTML Placeholder Attribute code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

Get free access key
placeholder.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" placeholder="Jane Doe" autocomplete="name" required>

  <label for="email">Email</label>
  <input type="email" id="email" name="email" placeholder="you@example.com" autocomplete="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" rows="5" placeholder="How can we help?" required></textarea>

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Send</button>
</form>

<style>
  ::placeholder {
    color: #6b7280;
    opacity: 1; /* Firefox lowers placeholder opacity by default */
  }
</style>

Key facts

How does placeholder behave?

placeholder is a hint for empty text-like fields. It is never submitted, it is styled with ::placeholder, and it is not a reliable accessible name.

How does placeholder behave?
FactDetail
Where it worksOn <input> types text, search, url, tel, email, password and number, and on <textarea>. It is ignored on checkbox, radio, file and date inputs and on <select>.
Not submittedThe placeholder is never sent. An untouched field sends an empty value, so required still fails.
Line breaksAllowed in a <textarea> placeholder, but not in an <input> placeholder.
StylingUse the ::placeholder pseudo-element. Firefox lowers its opacity by default, so set opacity: 1 to get the exact color.
:placeholder-shownThis CSS pseudo-class matches a field while its placeholder is visible, which is handy for floating-label effects.
AccessibilityIt is not a reliable accessible name. Screen readers handle it inconsistently, so every field still needs a <label>.

Sources: WHATWG HTML Standard: the placeholder attribute · MDN: input placeholder

Attributes · placeholder

Which attributes and CSS go with placeholder?

The attribute sets the hint text. These CSS selectors style it, and aria-describedby gives help text that doesn't disappear.

HTML Placeholder Attribute attributes and what each one does
AttributeWhat it does
placeholderThe hint text shown while the field is empty, like you@example.com. Keep it short and use it as an example, not as instructions.
::placeholderA CSS pseudo-element that styles the placeholder text, for example its color and font style.
:placeholder-shownA CSS pseudo-class that matches the field itself while the placeholder is visible, so you can style empty fields differently.
aria-describedbyThe accessible way to give lasting help text. Point it at the id of a visible hint, such as a format rule, that stays on screen while the visitor types.

Common mistakes

placeholder mistakes to avoid

Most placeholder problems come from asking it to do a label's or a default value's job.

  1. A placeholder is not a label

    The hint vanishes as soon as the visitor types, so they forget what the field was for, and screen readers announce placeholders inconsistently. Give every field a visible <label>.

  2. A placeholder is not a default value

    Placeholder text is never submitted. If the field should start with a real value that gets sent, use the value attribute instead.

  3. Light grey text fails contrast

    Very pale placeholder text fails the WCAG contrast check and is hard to read. Pick a darker grey such as #6b7280 on white and set opacity: 1.

  4. Don't hide format rules in the placeholder

    Rules like "8+ characters" or "DD/MM/YYYY" disappear on the first keystroke. Put them in visible help text linked with aria-describedby.

Sources: WHATWG HTML Standard: the placeholder attribute · MDN: input placeholder

Copy-paste ready

The HTML Placeholder Attribute example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html placeholder attribute form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this placeholder form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Placeholder Attribute to any page.

Copy the html placeholder attribute example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

Copy the code

Copy the HTML Placeholder Attribute example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

Drop the form into any HTML page. Submissions arrive in your dashboard.

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See payment forms →Need time slots? Online booking →

Setup guides for the stacks you use

Questions

HTML Placeholder Attribute questions, answered.

View all FAQs
Is placeholder text submitted with the form?

No. The placeholder is only a visual hint. If the visitor leaves the field untouched, the form sends an empty value for it, and a required field fails validation.

How do I change the placeholder color in CSS?

Use the ::placeholder pseudo-element, for example input::placeholder { color: #6b7280; opacity: 1; }. Firefox lowers placeholder opacity by default, so opacity: 1 makes the color match in every browser.

Can a placeholder replace a label?

No. The placeholder disappears as soon as the visitor starts typing, and screen readers don't handle it reliably as the field's name. Use a visible <label> and keep the placeholder as an optional example.

Does placeholder work on a select element?

No. <select> ignores the placeholder attribute. Instead, make the first <option> disabled and selected with an empty value, like <option value="" disabled selected>Choose one</option>. The HTML select page shows the full pattern.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08 per month, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions per month
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ