I'm working on my personal site and I need a few buttons in the center of the screen which will be links to things like my GitHub and resume and contact info but I can't center my buttons properly, the problem I'm getting is because of position: absolute;
When I use this the items are properly centered but they all stack together and when I don't have this the items have proper space in between them but they are all stuck to the top left corner of the page, all the online tutorials are saying to use position: absolute; so if anyone can help that would be great, I'll put all my code below.
button{
width: auto;
display: table;
border: 1px solid #fff;
padding: 10px 20px;
border-radius: 20px;
color: #42337d;
cursor: pointer;
margin-top: 25px;
transition: .2s;
font-size: 18px;
font-weight: 600;
text-decoration: none;
font-size: large;
margin: 0;
position: absolute;
top: 45%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
outline: none;
}
<html>
<head>
<title>site</title>
<script type="text/javascript" src="main.js"> </script>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
</head>
<body>
<button type="button" onClick="onClick()">GitHub</button>
<button type="button" onClick2="onClick2()">Resume</button>
<button type="button" onClick3="onClick3()">Contact Me</button>
</body>
</html>