Is <p> a container element in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Is <p> a container element in html?

10th May 2017, 1:37 PM
Tharindu Sankalpa
Tharindu Sankalpa - avatar
9 Answers
+ 6
If a tag can contain another or more tags then that tag is a container tag. (this might not be the formal definition). <p> or paragraph tag can contain <br/>, <i></i>, <strong></strong> etc tags so it is a container. 😊
10th May 2017, 1:53 PM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 12
yep
10th May 2017, 1:47 PM
Akeela Arfeen
Akeela Arfeen - avatar
+ 9
Yes, it is ^^
10th May 2017, 1:46 PM
visph
visph - avatar
+ 9
yes
10th May 2017, 1:55 PM
NimWing Yuan
NimWing Yuan - avatar
+ 6
<p> element is a container, but it cannot contain "everything": for example, <hr> is forbidden by Html5 specifications... putting one into a <p> element will cause browsers to correct the code by closing the <p> before the <hr> and either opening a new <p> ( wich doesn't inherit properties from previous ) or ignoring the orphan </p>...
10th May 2017, 3:56 PM
visph
visph - avatar
+ 4
<p></p> is a element that defines a paragraph. The <div> tag defines a division or a section. Most tags such as <section>, <header>, and <footer> behave very similarly to <div>'s. They're very much up to you to determine how you use them. However, you shouldn't overlook the importance of using <div>s, especially for styling. For readability though, <section>, <footer>, <header>, and also <article> can be very beneficial.
10th May 2017, 1:51 PM
Felipe Cruz
Felipe Cruz - avatar
+ 2
ya paragraph tag is a container tag we can contain everything in it
10th May 2017, 3:48 PM
Ayush
Ayush - avatar
+ 2
oo thanks @visph
10th May 2017, 3:59 PM
Ayush
Ayush - avatar
0
It is. BUT <P> elements are only allowed to contain inline elements. For example you can't put <div> or another <p> inside <p>.
23rd Sep 2019, 2:07 PM
Yury Kozlov
Yury Kozlov - avatar