0

Help! Can't use text-align!

I'm having troubles with align texts in a link. I tested on my computer but it still gave me the same result. Html: <!DOCTYPE html> <html> <head> <link rel=stylesheet style="text/css" href="fake.css"> <title>Page Title</title> </head> <body> <a href="another.html"> Another Page</a> </body> </html> And Css: a:link { text-align: center; } Pls help!

18th Feb 2018, 9:24 AM
Layum
Layum - avatar
7 Respostas
18th Feb 2018, 10:23 AM
Layum
Layum - avatar
+ 7
Try to wrap the <a> tag within a <div>, give the div a class name defined with text-align center in the CSS: .centerdiv{ text-align:center; } <div class="centerdiv"><a href="another.html">Another Page</a></div> Hth, cmiiw
18th Feb 2018, 10:04 AM
Ipang
+ 6
The text-align rule is applied to the <div> tag, not the <a>, I tested that in Code Playground, the link appears centered...
18th Feb 2018, 10:13 AM
Ipang
+ 5
Can you please link the code? the code in your original question isn't editable...
18th Feb 2018, 10:21 AM
Ipang
+ 1
I already tried. I also tried giving a class and a id to <a> but none of them worked.
18th Feb 2018, 10:07 AM
Layum
Layum - avatar
+ 1
Yeah it worked but it just a text not a link.
18th Feb 2018, 10:17 AM
Layum
Layum - avatar
+ 1
I tried to use a real website link. But nope still not workin!
18th Feb 2018, 10:19 AM
Layum
Layum - avatar