I would do the following:
<div>
<p>nested paragraph element</p>
</div>
given the paragraph is nested within the div element, so the spaces are before the opening element
this of course applies to multiple levels of nesting:
<div>
<div>
<p>lala</p>
</div>
</div>
this really improves readability and ensuring all tags are properly closed
Okey thanks for answering! Just so I got it correct, why is the reason you did two
like this:
<div>
<div>
Was it just to make it extra readable?
So it’s okey to write:
<div>
<p>nested paragraph element</p>
</div>
But to really make sure it’s readable and ensure all tags are closed you recomend to type:
<div>
<div>
<p>nested paragraph element</p>
</div>
</div>
Did I understand that right?
The extra div’s where just to demonstrate indention when you are dealing with multiple nested elements.
sometimes you need nested divs to get the layout of your website right
1 Like
I understood the previews lesson so whenever encounter problem which i don’t know how to solve it, I’ll ask you
Insha’Allah.
What is the the different of div tags and section tags?
What is the use of section tags in html document if div tags is representing the same task as section?
I used the “inspect” feature to see HTML and JavaScript code to create this HTML lesson. I noticed that the code contained div tags with different classes to them, for example, div class, div style, etc. I guess a coder is able to do different features with the div tag as far as I know.