문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top