+ 1
Why the second text is not aligned to the center
<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>
5 odpowiedzi
+ 9
Because anyway, the <hr> element is not an valid content for a <p> tag ^^ (semantically non sense)
So browsers will try to correct it mostly by dividing the <p> element in two, the second loosing inlined attributes among which 'style' delaration :P
You should write a structure like:
<p style="/* whatever you want */">text content</p>
<hr>
<p style="/* whatever else you want */">text content</p>
And fir aligning/sizing your <hr> element, you would be adviced to use css and container parent (could be the root <body> element):
<div style="text-align:right;">
<p style="text-align:center;">text content</p>
<hr style="width:50%;">
<p style="text-align:center;">text content</p>
</div>
Obviously, it's best practice to externalize css declaration (but here is for explain purpose ;))
+ 15
Try this:
<html>
<head>
<title>Attributes</title>
</head>
<body>
<p align="center">This is a text <br /></p>
<hr width="10%" align="right" /><br><p align=center> This is also a text.
</p>
</body>
</html>
+ 3
because it is mentioned align=right in hr tag. the property from the innermost element takes priority
0
so the next text should have aligned right but it's in the left side. @Gurpreet
0
This is the code from the HTML Basics Attributes lesson, and this is how the code is presented. Correct syntax needs to be updated with this code.