austinstout
austinstout

Reputation: 1220

Code Spacing and Indenting Tips

I know this might spur a bit of discussion, and that isn't want this site wants, but this question CAN be answered.

I always code in one way that I am starting to frown upon:

<html>

<head>

</head>

<body>

</body>

</html>

I double space everything, and I NEVER indent, really.

Can anyone advise me on how helpful indenting and such really is? In addition, how should I indent or space if it is better for your code?

Thank you, and...

if this question is not helpful please leave a comment or suggest an edit instead of rating it down...!

EDIT: Note, this edit is after Daniel Imm's answer

How should I Indent stuff like CSS or Javascript or PHP?

Upvotes: 1

Views: 471

Answers (1)

Daniel Imms
Daniel Imms

Reputation: 50189

Indenting means you can scan/read code much more easily basically. Start doing it and you will not know how you lived without it.

Also when you indent reading non-spaced out code is much easier. Do it like this for HTML, whenever you open a tag, make an indent:

<html>
    <head>
        <title></title>
    </head>
    <body>
        <div></div>
    </body>
</html>

Upvotes: 5

Related Questions