Pregunta

In my webpage, I have a lot of divs. I've been finding it very difficult, when seeing a few lines of closing tags - </div> s - to know which <div> it's closing.

I suppose I can use HTML comments to document which closing div corresponds to which opening div. I would use the div id in a comment near the closing tag.

But I feel like there must be a better way, despite the fact that Google turned up nothing relevant for my searches.

What is the best way to document closing divs?

¿Fue útil?

Solución

I'm not sure there is a community held 'best way'. But I often use html comments and I know a lot of other developers do too, looking at the source code on well formatted sites will show you its an often used technique.

<div id="some-id">
   ... Some Content ...
</div><!-- some id -->

This will read nicer if you have indentation for each of your block level elements.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top