Can you nest divs (ANSWERED) | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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