0
Time to live of attributes - Need an explanation
using the example from course <html> <body> <p align="center">text a<br /> <hr width="10%" align="right" />text b </p> </body> </html> Why is "a" centered and "b" not; they are both in the same paragraph (with the same attribute). for hr I can understand that the attribute center is overwritten, but afterwards closed again
2 Réponses
+ 1
Because <hr> elements are not supposed to be inside a <p> element, browsers considers that it's not a valid code and try to correct it as:
<p align="center">text a<br></p>
<hr width="10%" align="right">
<p>text b</p>
... 'losing' attributes of 'first' paragraph ^^ ( logical: for the browser, there's one ending </p> missing related to the <p align="center">, and one <p> missing related to the orphan </p>, the <hr> between implicitly meaning that no relation exists between the two paragraphs ;) )
( deprecated attributes otherwise, needed to be replaced with css styles )