+ 16

Can you nest divs (ANSWERED)

Like this: <div id=“example”> I have <div id=“example_2”> a question </div> </div> [ANSWERED] I had tried it before I posted this Q and A. In the code that I was trying out, which is not the code above, I had said “div if=“ instead of “div id=“ (Typo)

14th May 2018, 1:27 AM
🐺Michael🐺
🐺Michael🐺 - avatar
14 ответов
+ 10
Just make sure you close them all properly. Browsers are really forgiving and actually interpret what you mean when it comes to closing order of tags... but best to get in good practices early. That said... nest away good man. Nest away. :)
14th May 2018, 2:15 AM
Adam
Adam - avatar
+ 12
Coming In Second Sorry, in my code (not above) I had said “div if=“...”” 😂🤣😂🤣
14th May 2018, 1:38 AM
🐺Michael🐺
🐺Michael🐺 - avatar
+ 10
Have you tried it yet? The truth is that you can nest as many as youd like within another as long as you keep the correct syntax!😉
14th May 2018, 1:31 AM
Evan Martine
+ 6
Yep, you can. It is a very common practice.
14th May 2018, 1:40 AM
Mickel
Mickel - avatar
+ 5
yes very possibly
14th May 2018, 4:48 AM
🐯🐯Gimba Abdul Aziz🐯🐯
🐯🐯Gimba Abdul Aziz🐯🐯 - avatar
+ 4
Everyone I had tried it before I posted this Q and A. As I said to Coming In Second, in the code that I was trying out, which is not the code above, I had said “div if=“ instead of “div id=“
14th May 2018, 7:42 PM
🐺Michael🐺
🐺Michael🐺 - avatar
+ 3
🐺Michael🐺 Haha no problem youll have tons of goof ups like that when programming thats why teams are so efficient
14th May 2018, 1:58 AM
Evan Martine
+ 2
Yes u can. Just try it out!
14th May 2018, 2:18 PM
Hiro
Hiro - avatar
+ 1
As the other people said, sure you can, but it would be better to read if you indent the code.
14th May 2018, 4:08 PM
Flávia Nunes Pino
Flávia Nunes Pino - avatar
+ 1
yes it is possible and it is required in some circumstances depending on your application...
14th May 2018, 4:55 PM
Vishu Rana
Vishu Rana - avatar
+ 1
yes you can try it out anything is possible
15th May 2018, 8:45 AM
yusuf hamisi
yusuf hamisi - avatar
+ 1
yes you can
15th May 2018, 4:49 PM
Fatihu Oladimeji Sulaiman
Fatihu Oladimeji Sulaiman - avatar
+ 1
I find it easier to keep track of my coding and layout with nested divs, especially when I have a block that contains other elements. It gets easier to manage my CSS sheets, too as I can just have the children inherit a stylized theme instead of hunting for each div...but that's just my novice experience.
18th May 2018, 4:12 AM
Shaudawn
Shaudawn - avatar
+ 1
yes you can , and it is often uses to nested div
18th May 2018, 12:38 PM
Khushal Patel
Khushal Patel - avatar