Main Content
Two Pseudo-elements You Can Use
July 20, 2008 @ 9:43 am
Today on CSS-Discuss a user asked a question about the pseudo-element “:first-letter”. Having started designing websites when Netscape 4 was still a consideration I find it hard to unlearn a lot of things. I’ve been afraid to try stranger parts of CSS like pseudo-elements for a while and just never consider them when I’m designing a site. I decided to do a rough test of which pseudo-elements work and which do not.
There are 4 pseudo-elements defined by the W3C:
- :first-letter
- :first-line
- :before
- :after
You can so some amazing stuff with “:before” and “:after” in a browser that supports them, but unfortunately only “:first-letter” and “:first-line” are supported in all the major browsers.
Applying “:first-letter” and “:first-line” to a class or ID assigned to an HTML tag in this way “p:first-letter” looks like this:
First letter is blue.
First line in this paragraph is green. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
I’m adding them to my mental toolbox.
Leave a Reply
Topics:
Keywords:
Share:
Main Links
RSS Feeds
Recent Updates
- Overused Words: Bulletproof
- NewsWordy: Keyword Heavy CSS Driven Site
- Realtime Usage Statistics
- Animated GIF For CSS Sprites
- CSS Systems
- Reset, And Starting From Scratch
- Two Pseudo-elements You Can Use
- Semantic HTML Site Outline
- CSS Specificity
- Welcome To The New Blog
Topics
- About The Site (3)
- CSS Case Studies (1)
- CSS Globe (1)
- CSS Projects (1)
- CSS Thoughts (3)
- CSS Tips (3)
- CSS-Discuss (2)
- Overused Words (1)
- Site Usage (1)
Popular Keywords
- site statistics (0)
- about (1)
- css specificity (1)
- semantic HTML (1)
- naked CSS (1)
- pseudo-elements (1)
- css reset (1)
- starting over (1)
- CSS Systems (1)
- Natalie Downe (1)