Last active
May 28, 2017 07:43
-
-
Save pethaniakshay/1a8197dfe10e6217ff832a29d3aa813c 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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<title>Verticlly Center Text</title> | |
<style> | |
.centre-text { | |
display: table; | |
height: 100px; | |
width: 100%; | |
text-align: center; | |
border: 2px dashed #f69c55; | |
} | |
.text { | |
display: table-cell; | |
vertical-align: middle; | |
} | |
</style> | |
</head> | |
<body style="background:#3cedd5"> | |
<div class="centre-text"> | |
<span class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment