iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register

Go Back   WebForumz.com > Resources > Tips & Tricks > (X)HTML & CSS
Register All Albums Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Author


dangergeek
This author has not added a author biography.

RSS Feed

Your Options
Capitalize The First Letter of a Paragraph with CSS

Adding a capital letter to the beginning of a paragrash isn't difficult at all.

CSS

.capital {
font:70px/50px Georgia, "Times New Roman", Times, serif;
color: #003300;
background: #CCCC99;
border: 1px solid #003300;
padding: 5px 5px 2px 4px;
margin-right: 5px;
margin-top: 2px;
float: left;
}

You'll see I chose a font size of 70 pixels and a line height of 50 pixels. I have specified a line height so that I can control the space around the letter "A".

The rest of the properties add the border, and give just the right amount of spacing around the "A".

Finally the letter "A" is Floated left so the extra paragraph text will wrap around.

HTML

<span class="capital">A</span>
<p>dding a capital letter to the beginning of a
paragraph, isn't difficult at all.
Just one additional class in css and
a span added to the html and a simple paragraph now has a unique style!</p>
<p>See the css and html code below.</p>

 

Related Resources

Members's Comments
Posted at June 20th, 2008 by moojoo
Interesting but you can accomplish the same task simply using #foo:first-letter{} and then you don't need to use a span outside of the paragraph. Eliminating excessive markup and making it easier for development.

body{line-height:1.5em;}
p#foo:first-letter {color: #003300; background: #CCCC99; border: 1px solid #003300; padding: 5px 5px 2px 4px; margin:5px 3px 5px 5px; font-size:1.2em;}


Posted at June 15th, 2008 by simonb
Is there any way of doing this with out having to use the span tag?
Page 1 of 1


Search Engine Optimization by vBSEO 3.2.0 RC8