Q:

How to create drop caps effect using CSS

0

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Use the CSS ::first-letter pseudo-element

You can use the CSS ::first-letter pseudo-element to create beautiful drop caps for your articles. Drop caps are simply the first capital letter of a paragraph in much larger font size that has the depth of two or more lines of normal text. Let's check out an example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Drop Caps with CSS</title>
<style>
    p::first-letter {
        float: left;
        font-size: 5em;
        font-weight: bold;
        line-height: 1;
		text-shadow: 2px 2px 6px #000;
        margin: -0.07em 0.1em -0.1em 0;
    }
</style>
</head>
<body>
    <p>Tempor ipsum dolor sit amet, consectetur adipiscing elit. Nam eu sem lorem, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante. Vestibulum id metus ac nisl bibendum scelerisque non non purus. Suspendisse varius nibh non aliquet sagittis. In tincidunt orci sit amet elementum vestibulum. Vivamus fermentum in arcu in aliquam. Quisque aliquam porta odio in fringilla. Vivamus nisl leo, blandit at bibendum eu, tristique eget risus. Integer aliquet quam ut elit suscipit, id interdum neque porttitor. Integer faucibus ligula. estibulum quis quam ut magna consequat faucibus. Pellentesque eget nisi a mi suscipit tincidunt. Ut tempus dictum risus. Pellentesque viverra sagittis quam at mattis. Suspendisse potenti. Aliquam sit amet gravida nibh, facilisis gravida odio. Phasellus auctor velit at lacus blandit, commodo iaculis justo viverra. Etiam vitae est arcu. Mauris vel congue dolor.</p>
</body>
</html>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

HTML / CSS Frequently Asked Questions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to center align absolute positioned div using ... >>
<< How to disable spell checking from Input Box and T...