So i make a paragraph with a span for different font size in it (60px only text in span). when it comes to next line it makes a large separates space for first and second line.
span {
color: var(--orange-yellow-crayola);
display: inline-block;
font-size: 60px;
position: relative;
font-family: GreatVibes-Regular;
margin-top: -20px;
}
<p style="margin-left: -1px;">
<span>I</span> 'm Creative Director and UI/UX Designer from Sydney, Australia, working in web development and print media. I enjoy turning complex problems into simple, beautiful and intuitive designs. My job is to build your website so that it is functional
and user-friendly but at the same time attractive.
</p>
So im trying to make a different p and adjust the margin top so the text separates in normal distances.
But when im trying to make it responsive with smaller screen device, the span collapse with p because "display:inblock;".
Had you guys have any solution for this problem? (sorry for bad english)
span {
color: var(--orange-yellow-crayola);
display: inline-block;
font-size: 60px;
position: relative;
font-family: GreatVibes-Regular;
margin-top: -20px;
}
<p style="margin-left: -1px;">
<span>I</span>'m Creative Director and UI/UX Designer from Sydney, Australia, working in web development and print media.
</p>
<p style="margin-top: -35px;">I enjoy turning complex problems into simple, beautiful and intuitive designs. My job is to build your website so that it is functional and user-friendly but at the same time attractive. Moreover, I add personal touch to your product and make sure that
is eye-catching and easy to use. My aim is to bring across your message and identity in the most creative way. I created web design for many famous brand companies.
</p>
2
Answers
You could use the CSS-selector
:first-letter
instead of aspan
-element and set the first letter toline-height: 0
:As explained by makkusu :
::first-letter
and/or a line-height of 0px would do the trick.The reason for this "margin" is the bounding box of a glyph/character:
Each font has metrics defining the space above and below the baseline. These values are also called ascender and decender. See also "Understanding typography"
In other words: the browser text composing engine ensures characters won’t collide vertically (or horizontally).
Here is an example illustrating these bounding boxes:
We may also see implementations of new initial/drop cap properties like
initial-letter-align
– currently very experimental.