my html file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Using Web Font</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<p class="paragraph">Making the Web Beautiful!</p>
</body>
</html>
my css file:
html,
body {
font-size: 40px;
text-align: center;
padding-top: 3.5em;
}
@font-face {
font-family: 'Dancing Script';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(https://fonts.gstatic.com/s/dancingscript/v15/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BAyo3Sup8.woff2) format('woff2');
}
.paragraph {
font-family: 'Dancing Script';
font-style: normal;
font-weight: 500;
font-display: swap;
border-width: thick;
border-style: dashed solid;
border-color: red rgba(170, 50, 220, .6) green;
display: inline-block;
width: 9em;
margin:0 auto;
height: 10em;
vertical-align: middle;
}
Result: Result
As the height of .paragraph increases, the text won't change its position to be vertically centered again. Is there a way to make the text vertically centered as the height changes? I'm new to coding so I am really not sure...
It would be great if I can get some help! Thanks