Jump to content
SSteven

Code indentation in HTML

Recommended Posts

In programming languages (such as Javascript, C++, etc.), indentation of code is a best practice.

In markup languages such as HTML, is code indentation a best practice?

 

Share this post


Link to post
Share on other sites

Yes! it makes it easy to identify the hierarchy of the elements, such as parent child elements, most better editors do this automatically, with ability to collapse areas of html, so you can work to a specific area only.

Share this post


Link to post
Share on other sites

>> most better editors do this automatically, with ability to collapse areas of html

Notepad++ (with a popularity rating of 20% by users of this website) doesn't seem to auto-indent.

Which editor has an auto-indent feature? w3schools suggests an indentation level of 2 spaces, and I'm looking for an editor with 2-space auto-indentation.

Thanks.

Edited by SSteven
fix spelling

Share this post


Link to post
Share on other sites

Seems notepad++ requires plugin to auto indent, why they can't incorporate with program by default, seems stupid to me? there are several plugins, but be careful as some are not auto and require you to select menu, or combination of pressed keys to activate it each time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×