Six CSS pseudo-elements.
Six simple ideas.
A lot of possibilities.
::before ::after ::first-line ::first-letter ::marker ::selection
youtu.be/hP6hoCVOWbs
#CSS #Frontend #Coding
CSS doesn't always need more HTML.
Sometimes the cleaner solution is a pseudo-element.
Before adding another element to your markup, ask yourself:
"Could CSS handle this?"
youtu.be/hP6hoCVOWbs
#CSS #CleanCode #WebDevelopment
::selection doesn't permanently change your text.
It only changes its appearance while the user has selected it.
That makes it perfect for small UX/design touches.
youtu.be/hP6hoCVOWbs
#CSS #UXDesign #WebDev
Leta retweeted
light-dark() has worked in every major browser for a couple of years, but is often missed by developers and is a handy CSS function to use.
It picks a light or dark color from the page's color-scheme, so a theme toggle only has to flip color-scheme on the root.
One of my favorite things about ::first-line:
You don't manually define which words are part of the line.
The browser handles it based on the available space.
youtu.be/hP6hoCVOWbs
#CSS #WebDevelopment #Frontend
Here's a useful CSS mental model:
::first-line cares about a line.
::first-letter cares about a letter.
The names are almost the documentation.
youtu.be/hP6hoCVOWbs
#CSS #CodingTips #LearnCSS
A normal paragraph can become:
Big first letter. Styled first line. Custom selection colors.
All with CSS.
No complicated JavaScript required.
youtu.be/hP6hoCVOWbs
#CSS #WebDesign #FrontendDevelopment
If you're learning CSS, don't try to memorize everything.
Build a toolbox.
::before, ::after, ::first-line, ::first-letter, ::marker, and ::selection are six useful tools to add.
youtu.be/hP6hoCVOWbs
#CSS #LearnToCode #WebDevelopment
CSS gets more interesting when you stop thinking only about elements.
You can target:
The first line
The first letter
The list marker
Selected text
That's the power of pseudo-elements.
youtu.be/hP6hoCVOWbs
#CSS #Frontend #Coding
Want your website's lists to match your design system?
Don't forget ::marker.
It lets you customize the marker instead of accepting the browser's default bullet.
youtu.be/hP6hoCVOWbs
#CSS #WebDesign #Frontend
::before and ::after normally need the content property when you're generating content.
For example:
p::before {
content: "🌎";
}
A tiny detail that saves a lot of confusion.
youtu.be/hP6hoCVOWbs
#CSS #CodingTips #WebDev
Here's a beginner-friendly CSS concept:
Pseudo elements let you style a specific part of an element, or generate visual content, without changing the original HTML.
youtu.be/hP6hoCVOWbs
#CSS #LearnCSS #WebDevelopment
You can create:
🌎 icons
🏷️ labels
➖ decorative lines
🎨 custom list markers
✨ visual effects
…with techniques involving CSS pseudo-elements.
youtu.be/hP6hoCVOWbs
#CSS #WebDesign #FrontendDevelopment










