Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Created October 23, 2021 17:15
Show Gist options
  • Save topherPedersen/596226981a975398c286099810c38a61 to your computer and use it in GitHub Desktop.
Save topherPedersen/596226981a975398c286099810c38a61 to your computer and use it in GitHub Desktop.
Vertically & Horizontally Center h1 Tag
export default function Home() {
return(
<div
style={{
position: 'absolute',
display: 'flex',
alignItems: 'center',
height: '100%',
width: '100%',
top: 0,
bottom: 0,
margin: 0,
padding: 0,
backgroundColor: 'purple'
}}
>
<h1
style={{
textAlign: 'center',
width: '100%'
}}
>Vertically & Horizontally Centered Text Here</h1>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment