+ 2

How to make a hyperlink (<a>) align at the middle?

I write it in HTML and CSS: HTML : <a href="www.sololearn.com" class="target" align="center"> CSS : .target{ color: red; text-align: center; } I try using HTML first but it is align on the left so I use CSS. CSS also have the same result

23rd Jul 2017, 10:29 AM
Code Master
Code Master - avatar
8 Respostas
+ 5
if u want to use external css then a { text-align:center; display:block; }
23rd Jul 2017, 10:38 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 4
This way (use HTML): <p align="center"><a href="www.Sololearn.com>link</a></p>
23rd Jul 2017, 11:04 AM
benka
benka - avatar
+ 1
<a href="http://www.sololearn.com" style="margin:auto">SoloLearn</a>
23rd Jul 2017, 10:36 AM
Norbii85
Norbii85 - avatar
+ 1
@benka first of all close the anchor tag. secondly, the align attribute of p tag is deprecated in html5.. so use CSS instead..
23rd Jul 2017, 11:09 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
🤔🤔 go through the css inline properties.. if u want to use directly in html file..
23rd Jul 2017, 10:34 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
To @Norbii85. Not working
23rd Jul 2017, 10:38 AM
Code Master
Code Master - avatar
0
write display:block
23rd Jul 2017, 10:40 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Thanks
23rd Jul 2017, 10:42 AM
Code Master
Code Master - avatar