Reputation: 5197
For some reason, I've got an annoying padding/margin below my "large" font:
http://jsfiddle.net/o9gvgz8c/1/
I've enlarged the font more than I need, just to exaggerate the problem . The CSS in question is:
p::first-letter {
font-size: 40px;font-family: 'Special Elite',cursive;padding-right: 2px
}
If I don't use a larger font as the start character, then its fine... but as soon as I make the first letter larger, it adds this margin in.
How can I get around this?
Upvotes: 2
Views: 62
Reputation: 1904
Make sure to define your ::first-letter
line-height
property as either:
p::first-letter {
font-size: 50px;font-family: 'Special Elite',cursive;
padding-right: 2px;
line-height: 16px;
}
or
p::first-letter {
font-size: 50px;font-family: 'Special Elite',cursive;
padding-right: 2px;
line-height: 100%;
}
http://jsfiddle.net/o9gvgz8c/3/
Upvotes: 1
Reputation: 15951
adding line-height
will fix it
p::first-letter {
font-size: 50px;
font-family:'Special Elite', cursive;
padding-right: 2px;
line-height:10px;
}
Upvotes: 2
Reputation: 103790
You can remove that gap by specifying a line-height on the p
element :
p{line-height:18px;}
Upvotes: 1
Reputation: 4967
You can use relative sizing on the first letter and set the line-height
property to the relative height 100%
, like this:
p::first-letter {
font-size: 200%;
font-family: 'Special Elite',cursive;
padding-right: 2px;
line-height: 100%;
}
Upvotes: 1