why other half of paragraph not aligned center? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why other half of paragraph not aligned center?

I mean if I remove <hr /> element/tag, the full paragraph stays aligned center with br in it. but with hr, it seems like it's closing an invisible p tag before hr and starting one after it?

5th Jun 2016, 11:19 PM
Arafat Rahman
4 Answers
0
And your code is?
6th Jun 2016, 11:28 PM
ZinC
ZinC - avatar
0
<html> <head> <title>Attributes</title> </head> <body> <p align="center">This is a text <br /> <hr width="10%" align="right" /> This is also a text. </p> </body> </html> This one
6th Jun 2016, 11:32 PM
Arafat Rahman
0
You have to use css instead. 'align' is not supported in html5. <hr> has also another meaning in html5 than a rule. Give your <p> a border-bottom: <p style="border-bottom:1px solid #000;">text</p> Use padding to control how close to your paragraph you want the line to be.
6th Jun 2016, 11:56 PM
ZinC
ZinC - avatar
0
Oh yes, I forgot.. hr is a block-level element. Meaning it will force a linebreak and can't be put inside another block-level element, such as <p>, without breaking it.
7th Jun 2016, 12:13 AM
ZinC
ZinC - avatar