0

Why this text_p div not working in my code please any one can help

https://code.sololearn.com/WqZ789CA0u53/?ref=app

3rd Jun 2021, 10:53 AM
rahul barhate
rahul barhate - avatar
2 ответов
+ 2
If I do not have missed any other p elsewhere in your code, I guess you want them all centered... but you try to achieve that behavior by making many mistakes... first, you do not have to use h5 to make them centered... h(n) are for titles (h stand for heading, number is for hierarchy) second you put the opening tag at start of the first p content, and the closing one at end of the last p content, so they are both invalid and ignored third, you miss spacing between 'h5' and 'align', so the tag read is 'h5align', wich don't exist and is a second reason to be ignored. fourth is less important, but anyway: align attribute should not be used (deprecated: part of old versions of html) even if they still works... you should use css instead (either inlined with 'style' attribute or better by targeting the element as your other css rules) your structure should look like: <div style="text-align:center"> <p>content</p> <p>content</p> <p>content</p> </div>
3rd Jun 2021, 11:32 AM
visph
visph - avatar
+ 1
rahul barhate ... or even without 'div' container (could be any well suited block element, html5 provide much more semantically meaningfull elements) by either putting the style attribute to each p you want to override its default style, or better targeting them (all or more or less specifically) through your css definitions part ('style' tag), where it seems that you could just do: p { text-align: center; } as you doesn't have any else p not centered in your page... at least yet ;)
3rd Jun 2021, 11:32 AM
visph
visph - avatar