I have a span with CSS:
font-height = 120px;
height = 120px;
line-height = 120px;
The text within it does not occupy the complete height(120px) of the span. Is there any way to calculate the offset of the text within the span from upper and lower boundaries?
Or is this an way to make the text touch the upper and lower boundaries of the enclosing span tag?
jsFiddle Link for reference.
To include blank space in a document, you can use the <spacer> element. It is like an image, but actually, there isn't a picture there. You should specify <spacer> as one of the following types: horizontal, vertical, and block, which can be both horizontal and vertical.
Use the line-height property in CSS to do so. Browsers by default will create a certain amount of space between lines to ensure that the text is easily readable. For example, for 12-point type, a browser will place about 1 point of vertical space between lines.
Another way of making a <div> fill the remaining space is to use the CSS position property. Just set the position to “absolute” to stretch the <div>.
The \vspace command adds vertical space. The length of the space can be expressed in any terms that LaTeX understands, i.e., points, inches, etc. You can add negative as well as positive space with an \vspace command. LaTeX removes vertical space that comes at the end of a page.
This visually does it without javascript:
#abc {
margin: none;
border: dotted 1px red;
padding: 0;
height: 120px;
font-size:180px;
line-height:120px;
display:inline-block;
}
I think you need to use display:inline-block;
and adjust the font size according to the actual font you use.
JsFiddle here
The text is already taking 100% (120px) of the span height, you're forgetting other characters like "j" or "Á".
Try this html:
<span id="abc">jÁ / ABC</span>
and this css
#abc {
margin: none;
border: dotted 1px red;
padding: 0;
display:inline-block;
/*****120px*****/
height: 120px;
font-size:120px;
line-height:120px;
}
Test: http://jsfiddle.net/jTpfT/17/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With