How do i center a link tag in a div

Asked by: tomlance79
Viewed: 283
Answers: 1
  • 0

I have an a tag inside a div. I tried to center it with text-align, but it’s not working. How can i align it to the center?


Answer by: jenniryan

Answered on: 21 Jul 2023

  • 0

You need to add

text-align: center;


to the parent element, in your case to the div. Or you can use flexbox.

Please log in to post an answer!