+ 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>

5th Jul 2021, 10:29 PM
Матвей Барканов
Матвей Барканов - avatar
21 Respuestas
+ 1
Матвей Барканов Ok.... i think you are a beginner only ..
6th Jul 2021, 10:25 AM
KashishAggarwal
KashishAggarwal - avatar
+ 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.
6th Jul 2021, 4:20 PM
David Carroll
David Carroll - avatar
+ 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
6th Jul 2021, 1:56 PM
David Ordás
David Ordás - avatar
+ 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>
5th Jul 2021, 10:41 PM
visph
visph - avatar
+ 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> ;)
5th Jul 2021, 10:46 PM
visph
visph - avatar
+ 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.
6th Jul 2021, 1:24 PM
David Carroll
David Carroll - avatar
6th Jul 2021, 3:44 PM
David Ordás
David Ordás - avatar
+ 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.
5th Jul 2021, 11:32 PM
David Carroll
David Carroll - avatar
+ 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.
6th Jul 2021, 8:18 AM
David Carroll
David Carroll - avatar
+ 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
6th Jul 2021, 3:04 PM
visph
visph - avatar
0
<br/> put in a lesson in SoloLearn
6th Jul 2021, 7:32 AM
Матвей Барканов
Матвей Барканов - avatar
0
followed by an <hr> and all inside a <p> ??? :o
6th Jul 2021, 7:43 AM
visph
visph - avatar
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
6th Jul 2021, 7:45 AM
Матвей Барканов
Матвей Барканов - avatar
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/>
6th Jul 2021, 10:18 AM
KashishAggarwal
KashishAggarwal - avatar
0
br was in a lesson in SoloLearn
6th Jul 2021, 10:19 AM
Матвей Барканов
Матвей Барканов - avatar
0
It’s true
6th Jul 2021, 10:26 AM
Матвей Барканов
Матвей Барканов - avatar
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
6th Jul 2021, 3:55 PM
visph
visph - avatar
0
So that we can get broken line to other paragraph
7th Jul 2021, 8:42 AM
Frank J Abel
Frank J Abel - avatar
7th Jul 2021, 2:58 AM
PRIYANSHU
PRIYANSHU - avatar
- 1
to break that line
7th Jul 2021, 8:11 AM
Patnala Venkatesh
Patnala Venkatesh - avatar