This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Mateus Tavares
over 10 years

Why can't I text-align property to a hyperlink?

In this exercise, the link is inside the div, but my text is only centered if I use the text-align property in the div. If I try using it directly on ‘a’ selector, it won’t align my text.

Check screenshot for situation #1, where text-align is in the div: https://www.diigo.com/item/image/4qlwr/gx0p

Situation #2, where text-align is in ‘a’, and text is not centered: https://www.diigo.com/item/image/4qlwr/brvo

Answer 534b9221548c3589f900215a

1 vote

Permalink

because if you assign the text-align center property to the div, it will align everything inside the div. but if you assign the text-align center to the link, the computer doesn’t know to centralize it. the computer can’t tell where to what element it should centralize.

text-align propertys should always be assigned to div elements, block elements so that the computer knows: the text in this box needs to be centralized. if you assign it to the link, it doesn’t know to which block it should be centralized.

points
Submitted by stetim94
over 10 years