CSS3 Drop Caps tutorial. Today is design orienting article. I am going to tell you about making nice-looking drop caps with css3. I sure that you have been already saw these big letters in each children’s book of fairy tales. Especially in old books. To repeat this effect some webmasters separated this first letter (into own DOM element) and applied special own styles for it. But, this is not necessary in case of CSS3. We can use :first-letter selector to select necessary first symbol. Lets take a look to result that we can achieve

Here are samples and downloadable package:
[sociallocker]
[/sociallocker]
Ok, download the example files and lets start coding !
Step 1. HTML
Here is basic html structure of our page:
index.html
04 | < meta charset = "utf-8" /> |
05 | < title >CSS3 Drop Caps | Script Tutorials</ title > |
06 | < link rel = "stylesheet" href = "css/layout.css" type = "text/css" media = "screen" > |
10 | < h2 >CSS3 Drop Caps</ h2 > |
13 | < div class = "container" > |
14 | < div >The King sat naked. Like a foolish pauper on the street, he sat leaning |
15 | against a cold wall, drawing in his blue, goose-bumped legs. He shivered, |
16 | with his eyes closed, he listened, but everything was quiet.</ div > |
17 | < div >He awoke at midnight from a nightmare and immediatelly understood that |
18 | he was finished. Some one weezed and writhed by the door of the bedroom |
19 | suite, he heard footsteps, metalic jingling and drunken mummbling of His |
20 | Highness, Uncle Buht: "Let me through... Let me.. Break it down, hell with |
21 | it..." Wet with icy sweat, he slintly rolled off his bed, ducked into a |
22 | secter closet, and loosing himself he ran down the underground passage. |
23 | Something sqelched under his bare feet, the startled rats dashed away, but |
24 | he did not notice anything, just now, sitting next to a wall he remembered |
25 | everything; the darkness, the slippery walls, and the pain from a blow on |
26 | the head against the shakled door to the temple, and his own unberable high |
28 | < div >They shall not enter here, he thought. No one shall enter here. Only if |
29 | the King order's so. But the King shall not order... He snickered |
30 | hysterically. Oh no, the King will not order! He carefully un screwed up his |
31 | eyes and saw his blue, hairless legs with scraped knees. Still alive, he |
32 | thought. I will live, because they shall not enter here.</ div > |
33 | < div >Everything in the temple was blueish from the cold light of the |
34 | lanterns -- long glowing tubes that were stretched under the ceiling. In the |
35 | center, God stood on an eminence, big, heavy, with sparkling dead eyes. The |
36 | King continuously and stupidly stared, until God was suddenly screened by a |
37 | shabby lay brother, still a greenhorn. Scraching, with an open mouth he |
38 | gazed at the naked King. The King squinted once again. Scum, he thought, a |
39 | lousy vermine, catch the mongrel and to the dogs, for them to ravage... He |
40 | reasoned that he did not remember the lout well, but he was long gone. So |
41 | scrawny, snotty... That's all right, we'll remember. We'll remeber |
42 | everything, Your Highness, Uncle Buht. During the father's reighn, I dare |
43 | say you sat quietly, drank a bit and kept silent, were afraid to be noticed, |
44 | you knew that King Prostyaga did not forget you ignoble treachery...</ div > |
45 | < div >Great was the father, the King thought with an accustomed envy. You'd |
46 | be great, if your advisors are God's angels in flesh. All know, all have |
47 | seen them: their faces fearful, white, like milk, and their garment were |
48 | such that one could not understand if they were naked or not. And their |
49 | arrows were fiery, like lightning, they drove off the nomads with the |
50 | arrows, and although they casted them overhead, half the horde cripled from |
51 | fear. His Highness, Uncle Buht, wispered once upon a time, drunk and |
52 | burping, that those arrows can be cast by anyone, that special slings are |
53 | needed that the angels have and that would be nice to take from them. And he |
54 | said then -- he was drunk then, -- that if it is nice to have, why not have |
55 | it, why not... Soon after that table talk one angel fell off the wall into |
56 | the moat, probably slipped. Next to him they found one of uncle's body |
57 | guards with a javelin between his shoulder blades. It was a dark, dark |
58 | deed... It good that the people did not care about the angels, they were |
59 | scary to look at, but it is not clear why is it scary -- angels were happy, |
60 | cordial people. Only their eyes were scary. Small, shiny, and they keep |
61 | racing around... non humanoid eyes, not peaceful. So the people hushed down, |
62 | although father, King Prostyaga gave them such freedom that it is shameful |
63 | to remember... although, before the Coup, father, they say was a saddle |
64 | maker. For saying so, with my own hands I had torn eyes out, and sewen ears |
65 | shut. But I remember, he used to sit in the evenings by the Crystal Tower, |
66 | and he would cut out leather -- beautiful work. And I would perch myself at |
67 | his side, it's warm and comfy... The angels were singing from the rooms, so |
68 | quietly, and in harmony, and father would start to accompany -- he knew |
69 | their language -- it used to be spacious, nobody around... not like now, |
70 | guards are stuck at every corner, but there is no sense in it...</ div > |
Step 2. CSS
Here are all necessary CSS styles for achieve this effect:
css/slider.css
06 | background-color : #eee ; |
08 | font : 14px / 1.3 Arial , sans-serif ; |
11 | background-color : #212121 ; |
12 | box-shadow: 0 -1px 2px #111111 ; |
28 | header a.stuts,a.stuts:visited{ |
35 | margin : 23px 0 0 110px ; |
45 | border : 1px dotted #000000 ; |
54 | font-family : celticmd; |
55 | src : url ( "celticmd.ttf" ) format ( "truetype" ); |
59 | font-family : "celticmd" ,Sans- Serif ; |
62 | text-shadow : 2px 2px 2px rgba( 0 , 0 , 0 , 0.2 ); |
64 | .container div:first-letter { |
69 | text-transform : uppercase ; |
First half of styles is page layout. But last three are most important. We have added custom font (celticmd.ttf) with using ‘@font-face’. First letter of each row is selected with ‘:first-letter’ selector. Each first letter of each row is increased in size, uppercase, floated left to allow it to break out of the paragraph’s flow, last – applied custom margins.
Conclusion
Our new tutorial is complete. Today we have learned about customization of drop cap letters. Welcome back. Good luck!