Last active
January 3, 2024 05:56
-
-
Save tomcam/4dd6dfb90abdc504daccd9a8003329a3 to your computer and use it in GitHub Desktop.
How should I center vertically with spectre.css?
This file contains 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="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Center test 1 | Spectre.css</title> | |
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css"> | |
<style> | |
<!-- NOT NECESSARY! JUST USE .flex-centered. See comment by @Prid13 at https://gist.github.com/tomcam/4dd6dfb90abdc504daccd9a8003329a3?permalink_comment_id=4815360#gistcomment-4815360 --> | |
.vcenter { | |
text-align: center; | |
position: absolute; | |
left: 50%; | |
top: 50%; | |
-webkit-transform: translateX(-50%) translateY(-50%); | |
transform: translateX(-50%) translateY(-50%); | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="columns"> | |
<div class="column vcenter"> | |
<h1>CENTERED</h1> | |
</div> | |
</div> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much, @Prid13!