+ 1

Why sometimes text-align doesn't work?

Hi, I was coding a website today and I have a problem: When I give an id to a paragraph or a heading, and in CSS type text-align:center, it doesn't work.

16th May 2020, 8:03 PM
Emina Gabeljić
Emina Gabeljić - avatar
3 Antworten
+ 11
You can't center a div with that instruction but you can center a paragraph inside the div by using text-align. If you could share your code it would be easier to help you. :)
16th May 2020, 8:08 PM
Maz
Maz - avatar
+ 6
text-align only work on block element, it would not work if the elements set to inline.
17th May 2020, 5:55 AM
Calviղ
Calviղ - avatar
+ 1
It depends on code. May be there inline styles can be Overriding it...
16th May 2020, 8:08 PM
Jayakrishna 🇮🇳