Thursday, December 6, 2012

:first-letter property


:first-letter does not work on inline elements such as a span:first-letter works onblock elements such as a paragraph, table caption, table cell, list item, or those with the inline-block property applied.
Therefore it's better to apply :first-letter to a p instead of a span.
p:first-letter {font-size: 500px;}
or if you want a :first-letter selector in a span then write it like this:
p b span:first-letter {font-size: 500px !important;}
span {display:block}
The :first-letter pseudo-element is mainly used for creating common typographical effects like drop caps. This pseudo-element represents the first character of the first formatted line of text in a block-level element, an inline block, a table caption, a table cell, or a list item.
http://jsfiddle.net/sandeep/KvGr2/9/

No comments: