+ 1
Why I need to put it <br /> in 6th line
html> <head> <title>Атрибуты</title> </head> <body> <p align="center">Параграф текста.<br /> <hr width="10%" align="right" />Строка текста. </p> </body> </html>
21 Réponses
+ 1
Матвей Барканов
Ok.... i think you are a beginner only ..
+ 7
LOL... Out of all the interesting dialog, points being made about the topic of markup usage, and the effort to better understand the nature of the question as presented by the OP...
The one that gets marked as the Accepted Answer is the one that simply comments on the OP's level:
"Ok.... i think you are a beginner only .."
I have no words. 🤦♂️
Матвей Барканов If you want to do the community a service, you should probably accept an response that best answers your question. If you asked me, I would say it was the very first answer from visph.
Best of luck to you on your learning. I'm officially checking out of the thread as it's beyond over discussed by now.
+ 6
Inside a P tag can only be placed formatting tags or BRs
Put HR outside and might be sure if width are provided make it also display:block
Remember pass W3C validators to your code 😉
https://validator.w3.org/#validate_by_input
Normall, browser are capable of fixing and move all wrong code outside when its DOM is parsed. The expected result is unpredictable comparing one engine to another. e.g. webkit, mozilla, ie
MDN docs
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#phrasing_content
+ 2
you don't need <br /> in this case, as <hr> is of block type element (start on a new line)
also, <hr> is not allowed as content of <p>... that's why the text coming next is not centered as is the text coming before: browser correct your code and so use:
<html>
<head>
<title>Атрибуты</title>
</head>
<body>
<p align="center">Параграф текста.<br />
</p>
<hr width="10%" align="right" />
<p>Строка текста.
</p>
</body>
</html>
+ 2
however, if you remove completly the <hr>, then the <br /> force text after to start on a new line... and both lines will be centered, as part of same <p> ;)
+ 2
I now realize the OP clarified the <hr> was not within <p> tags, which is what I was looking for in a lesson.
Still... the lessons using <br> don't make sense. <br> should be used only when the explicit line break is part of the content, not just for effect.
A good example of this is in literary structures. Otherwise, if the content may be presented without the line break in some cases, styling should be applied instead.
Also, the <hr> tag should NOT be used in <p> tags.
Hope this clarifies usage issues based on the markup presented here.
+ 2
Who downvoted me? I haven't wrote anything that it was truth.
Test it on W3C validator
https://validator.w3.org/#validate_by_input
MDN docs
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#phrasing_content
+ 1
Матвей Барканов Why do you think you need <br/> on line 6?
What's the difference in behavior you are observing?
Using <br> doesn't seem to make a difference when I test your code.
+ 1
Weird... I'll see if I can locate that part of the lesson.
UPDATE: Матвей Барканов Which lesson challenge should I be looking for? I'm unable to locate one with the <hr> tag in the <p> tag.
+ 1
anyway, if lesson doesn't put <hr> inside <p>, putting <br> at end of <p> does not make much sense, as new line line is done by closing the <p> tag and with or without <br> that doesn't change anything ^^
however, that's valid, while putting <hr> inside <p> is not and would be more surprising if lesson have give such invalid example ;P
0
<br/> put in a lesson in SoloLearn
0
followed by an <hr> and all inside a <p> ??? :o
0
<html>
<head>
<title>Атрибуты</title>
</head>
<body>
<p align="center">Параграф текста.<br />
</p>
<hr width="10%" align="right" />
<p>Строка текста.
</p>
</body>
</html>
So this is a verbatim code
0
<br/> are used to separate lines (like of ; in js ) ..........
so your question is that .."why you have a need of <br/> in your code".
I think🤔🤔 Maybe ,,... because you want that .. hr .. in next line and you think that. Because <hr > is a part of <p> it will be in this line so ........ you use <br/>
0
br was in a lesson in SoloLearn
0
It’s true
0
David Ordás I was downvoting you because mainly you was upvoting yourself ^^
also, I still have said that <hr> is not allowed as content of <p> since the first answer of this thread, explaining in addition the behavior of browsers in such case ;P
0
So that we can get broken line to other paragraph
- 1
to break that line