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!
7 Antworten
+ 1
+ 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
+ 6
The text-align rule is applied to the <div> tag, not the <a>, I tested that in Code Playground, the link appears centered...
+ 5
Can you please link the code? the code in your original question isn't editable...
+ 1
I already tried. I also tried giving a class and a id to <a> but none of them worked.
+ 1
Yeah it worked but it just a text not a link.
+ 1
I tried to use a real website link. But nope still not workin!