+ 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; }

1st Jun 2019, 7:35 PM
Добежал фуопйль ярлычок
Добежал фуопйль ярлычок - avatar
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%);
1st Jun 2019, 8:31 PM
PanicS
PanicS - avatar
+ 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; }
1st Jun 2019, 7:38 PM
Airree
Airree - avatar
+ 1
thanks both of you, this had me stumped
2nd Jun 2019, 12:44 AM
Добежал фуопйль ярлычок
Добежал фуопйль ярлычок - avatar