+ 3

Will the paragraph appears center in the page?

I just came up with this question in a challenge. Given markup as follows. <p align="center">Text</p> We all know that the <p> element is a block level element and will never be centered unless someone makes it as a inline element. Here only the "Text", paragraph text will be aligned in center format. I would like to know about your thoughts on this question. For the record correct answer was the "Yes". But I guess it should be "No" since it asks about the paragraph element itself.

18th Nov 2017, 4:12 AM
Sajith Warnasooriya
Sajith Warnasooriya - avatar
5 Answers
+ 2
Yes, text inside p tag with align attribute set to center would make the text center, due to p is display block which occupy 100% width of parent. if you set p tag to inline, its text can't be center even though with align attribute set to center, since p tag is not 100% width now. There is a text node inside p tag, you must take into consideration in alignment.
18th Nov 2017, 5:07 AM
CalviÕ²
CalviÕ² - avatar
+ 2
Thanks to both. I think the question should be more specific. Just my personal thoughts.
18th Nov 2017, 8:48 AM
Sajith Warnasooriya
Sajith Warnasooriya - avatar
+ 1
I think that it is asking about the content in the paragraph. I think that this question is right.
18th Nov 2017, 5:05 AM
Learnsolo
+ 1
Couldn't get your question. Can you explain?
20th Nov 2017, 12:26 PM
Sajith Warnasooriya
Sajith Warnasooriya - avatar
0
Which tag for title
20th Nov 2017, 12:21 PM
Aye Hmwe
Aye Hmwe - avatar