Collected by Elizabeth Janson Home Page |
|
:first-line Pseudo-elementThe length of the first line depends on a number of factors, such as the width of the page and the font size. The :first-line pseudo-element can only be attached to a block-level element.The :first-line pseudo-element is similar to an inline-level element, but with certain restrictions. Only the following properties apply to a :first-line pseudo-element: font properties, color properties, background properties, 'word-spacing', 'letter-spacing', 'text-decoration', 'vertical-align', 'text-transform', 'line-height', 'text-shadow', and 'clear'. This example shows how to use the :first-line pseudo-element. The following rule changes to uppercase the letters of the first line of elements with the specified className property. <P CLASS="blueline">The first line in this paragraph will have uppercase letters which are blue, 'bold', and in 12 pt sans-serif font. Subsequent lines will render normally. The first line in this paragraph will have uppercase letters. Subsequent lines will render normally.</P><STYLE> .blueline:first-line { text-transform: uppercase; font: bold 12pt Helvetica, Verdana, Arial, sans-serif; color:blue } </STYLE> The first line in this paragraph will have uppercase letters which are blue, 'bold', and in 12 pt sans-serif font. Subsequent lines will render normally. The first line in this paragraph will have uppercase letters. Subsequent lines will render normally. The following rule illustrates the cumulative effect of attaching :first-line and :first-letter pseudo-elements to an element. <P CLASS="LetterAndLine">The first letter in this paragraph will be twice the size of the other letters in the paragraph. The first line in this paragraph will have uppercase letters. Subsequent lines will render normally. The first letter in this paragraph will be twice the size of the other letters in the paragraph. The first line in this paragraph will have uppercase letters. Subsequent lines will render normally.</P><STYLE> .LetterAndLine:first-line { text-transform: uppercase; color:red } .LetterAndLine:first-letter { font-size: 300%; float: left; color:blue } </STYLE> The first letter in this paragraph will be twice the size of the other letters in the paragraph. The first line in this paragraph will have uppercase letters. Subsequent lines will render normally. The first letter in this paragraph will be twice the size of the other letters in the paragraph. The first line in this paragraph will have uppercase letters. Subsequent lines will render normally. The following example uses the :first-line pseudo-element to create a typographical effect that looks like a column in a newspaper. <DIV class="col1"> <DIV class="newsitem">New features in Internet Explorer 5.5 include the first-line pseudo-element. This allows authors to create typographical effects that are applied to the first line of a block of text.</DIV> </DIV><STYLE> .col1 { border-right: black 1px solid; padding-right: 10px; padding-left: 5px; width: 140px; text-justify: newspaper } .newsitem:first-line { font-size: 14pt; left: 0px; float: left; position: absolute; top: 100px } </STYLE> New features in Internet Explorer 5.5 include
the first-line pseudo-element. This allows authors to create
typographical effects that are applied to the first line of a block
of text.
|
CSS begins here |
|
This page is part of Elizabeth Janson's web site
http://www.oocities.org/elizatk/index.html
Tetbury residents in the Eighteenth Century my Australian Family History and Barrie, our Family Poet. |