Skip to content

Instantly share code, notes, and snippets.

@pethaniakshay
Last active June 23, 2025 00:47
Show Gist options
  • Save pethaniakshay/34b57707d9d6d4ab35b03bb02b7dd968 to your computer and use it in GitHub Desktop.
Save pethaniakshay/34b57707d9d6d4ab35b03bb02b7dd968 to your computer and use it in GitHub Desktop.
HTML/CSS code to vertically+horizontally centre the text in div tag. https://www.codepuran.com/web-designing/vertically-horizontally-align-text-div/
<!DOCTYPE html>
<html lang="de">
<head>
<title>Verticlly Center Text</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
body {
display: table;
}
.centered-text {
text-align: center;
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body style="background:#3cedd5">
<div class="centered-text">
<h1>Yes It's My landing Page</h1>
<h2>Under Construction, Coming Soon !!!</h2>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment