+ 3
Need help with website code problem
I can’t align to the center a link, what is wrong with this code? Html: <a href=“example.html” id=“SignUp”>Sign Up</a> Css: #SignUp{ text-align:center; }
4 Answers
+ 10
Well <a> is inline tag because of that text-align dont work how it schuld. You can solve this on many way. Like above, also you can put <a> tag in <div> and than align <div> tag to center, or even add margin:0 auto;
if you use position to center item do:
position:absolute/relative.. ;
left:50%;
transform:translateX(-50%);
+ 2
It's actually aligned, but only the text inside the link. The link itself is aligned to the left. To center everything in an HTML file, use:
body {
align-items: center;
justifx-content: center;
display: flex;
}
+ 1
thanks both of you, this had me stumped