Every so often (well, actually, quite often), I 'discover' a new CSS property that I have not used before. Here's one. The first-line pseudo-element may be used to add a different style to the first line of text of an element.
For example, the first line of a paragraph with a class of 'example' may be styled according to this first-line pseudo element style rule:
p.example:first-line {
color: #693;
font-style: italic;
font-size: 120%;
}
Example paragraph where the first line is styled quite differently to the second line. In fact, the first line of this paragraph is an attractive green color, a larger font size, and italicised.
The first line ends/breaks where the browser says. This means that flexible layouts or user text resizing will change (the word) where the first line styling ends. Cool.
The first-line pseudo-element can only be used with block-level elements. However, not all properties can be used. 'Text' properties like font, color, background, word-spacing, letter-spacing, text-decoration, vertical-align, text-transform, line-height, and clear, seem to be OK.
Browser support for the first-line pseudo-element is pretty good these days. Most modern browsers support it. This does not include IE6 - but IE7 is supportive.
Stunning CSS3: A Project-Based Guide: Use this book to work through a series of practical yet cutting-edge projects. Each chapter walks you through standalone exercises that you can integrate into projects you're working on, or use as inspiration.
» Buy from Amazon.com · Amazon.co.uk
ThemeForest sell a range of site templates from some fantastic designers. They also sell some great WordPress themes!
Online invoicing made easy with CurdBee!
» Sign up
Join SugarSync for online backup. Sync your files between Mac, PC and mobile phone. Get 5 GB FREE and up to 10 GB bonus space!
HTML5 and CSS3 for the Real World will show you how to create websites using these new methods.
This easy-to-follow guide covers everything you need to know to get started. You’ll master the new semantic markup available in HTML5, as well as how to use CSS3 without sacrificing clean markup or resorting to complex workarounds. Buy the Book! · FREE Chapters