"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Monday, July 11, 2011

The :first-letter Pseudo-element

In my last post i shared abt  :first-line Pseudo-element, Today abt :first-letter Pseudo-element.
The "first-letter" pseudo-element is used to add a special style to the first letter of a text:

Code
<html>
<head>
<style type="text/css">
p:first-letter
{
color:#ff0000;
font-size:xx-large;
}
</style>
</head>
<body>
<p>www.simplyasp.blogspot.com/2010/06/show-image-from-database-and-mouse-over.html</p>
</body>
</html>

Output










Note: The "first-letter" pseudo-element can only be used with block-level elements.
Note: The following properties apply to the "first-letter" pseudo- element:
  • font properties
  • color properties 
  • background properties
  • margin properties
  • padding properties
  • border properties
  • text-decoration
  • vertical-align (only if "float" is "none")
  • text-transform
  • line-height
  • float
  • clear
Have a nice day... 'N happy Coding :)

No comments: