Yesterday I asked the question How to make text vertically and horizontally center in an HTML page, regarding a way to center text in the middle of a page (vertical and horizontal).
The solution works fine, but now I want to increase the text size, but the problem is that I do not want to use the 'px' like unit measure, because is a static way and could not adapt to all screen sizes.
I therefore want to use the percentage unit measure for text.
HTML code:
<body>
<div class="my-block">
WORD1<br />
WORDWORDWORDWORD2
</div>
</body>
The difficulty I am facing is with the height of the <div />
. I cannot put the height of the div
equal to the height of the body
, the width is equal because the div is a block element, but how I put the height of the div
equal to the height of the body
?
I already tried to put the padding
and margin
as 0
and the height
to 100%
but nothing works.
Can anyone help me?