::placeholder ::selection and ::marker
Style input placeholders, text selections, and list marker bullets with pseudo-elements.
::placeholder ::selection and ::marker is a free CSS Academy lesson on CoddyKit. This is lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, and your progress syncs across the web and the CoddyKit app. The CSS Academy course includes 4 lessons in total.
::placeholder
::placeholder styles the placeholder text inside form input and textarea elements. Only a subset of CSS properties are supported.
<input type="text" placeholder="Type your name…" />Supported ::placeholder Properties
Not all CSS properties work on ::placeholder. Supported properties include: color, font-size, font-weight, font-style, letter-spacing, opacity, and a few others. Layout properties are not supported.
Placeholder Accessibility
Placeholder text disappears when users type and should NOT be used as a substitute for <label> elements. Always provide visible labels for form fields. Placeholder contrast must also meet WCAG 4.5:1 ratio.
::selection
::selection styles text that the user has highlighted with the cursor. It creates branded selection colors.
<p>Select this text with your cursor to see the branded highlight color.</p>::selection Supported Properties
Only a handful of properties work with ::selection: color, background-color, text-shadow, and text-decoration. Others are ignored.
::marker
::marker styles the list item marker — the bullet or number in <ul> and <ol> lists.
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
<ol>
<li>Step one</li>
<li>Step two</li>
</ol>::marker Supported Properties
Supported ::marker properties include: color, content, font-size, font-family, font-weight, font-style, and unicode-bidi.
Custom List Markers with ::marker
Use emoji or special characters as list markers:
<ul>
<li>Normal item</li>
<li class="warning">Warning item</li>
</ul>::first-line
::first-line styles the first rendered line of a block element — the actual line as rendered, not the first line break in HTML. Useful for drop-cap-like lead paragraph styling.
<p>This is the opening line of a paragraph that wraps onto a second line once it runs out of horizontal room in its container, so you can see the effect clearly.</p>::first-letter
::first-letter targets the first letter of the first formatted line. Classic use: drop caps in magazine-style typography.
<p>Once upon a time, a designer discovered the drop cap and typography was never the same again.</p>::cue for Subtitle Styling
::cue styles VTT subtitles in HTML <video> elements — a specialized but important pseudo-element for accessible media.
<p style="color:#888;">::cue styles VTT subtitle text inside a <video> element (no visible effect without an active video/track, shown here for reference).</p>
<video controls style="max-width:100%;"></video>Quick Check
Which pseudo-element allows styling the bullet or number of a list item?
Recap
::placeholder styles input placeholder text. ::selection styles highlighted text. ::marker styles list bullets and numbers. ::first-letter and ::first-line enable typographic fine-tuning. All support only a limited subset of CSS properties.
Learn CSS with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 40
- Lessons
- 159
Frequently Asked Questions
Is the “::placeholder ::selection and ::marker” lesson free?
Yes — the full text of “::placeholder ::selection and ::marker” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO. The CSS Academy course includes 4 lessons in total.
What will I learn in “::placeholder ::selection and ::marker”?
Style input placeholders, text selections, and list marker bullets with pseudo-elements. You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start CSS Academy?
No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 4.
How long does the “::placeholder ::selection and ::marker” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this CSS Academy lesson?
Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- ::before and ::after Content
- ::placeholder ::selection and ::marker
- CSS Counters with ::before
- Decorative Patterns with Pseudo-elements