Poll: Do you indent your html code?

Chaotic42

Lifer
Jun 15, 2001
34,080
1,240
126
Normally. Sometimes I don't really worry about it. My code isn't interesting enough for people to want to read.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Jeez, I hope I never have to maintain any of your code :p Unindented code is brutal to read, whether you wrote it or not, and it's so easy to do!
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
I indent whatever code I actually write. If Im writing perl or PHP, I indent that so that it makes sense. Often the HTML it generates isn't nicely indented, but that's not what I have to maintain.
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
Do you guys indent with a tab or a couple spaces? I'm in the habit of using two or three spaces now for actual programming code (C, PHP, etc), but I still prefer tabs with HTML.
 

Chaotic42

Lifer
Jun 15, 2001
34,080
1,240
126
Originally posted by: igowerf
Do you guys indent with a tab or a couple spaces? I'm in the habit of using two or three spaces now for actual programming code (C, PHP, etc), but I still prefer tabs with HTML.

I love the three space tab myself.
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Originally posted by: notfred
I indent whatever code I actually write. If Im writing perl or PHP, I indent that so that it makes sense. Often the HTML it generates isn't nicely indented, but that's not what I have to maintain.

 

AdamSnow

Diamond Member
Nov 21, 2002
5,736
0
76
I Indent all my code regardless of the language it's in...

I usually just use 3 spaces... but tab works too... :) just be consistant... :p
 

Supermercado

Diamond Member
Jan 18, 2002
5,893
0
76
Originally posted by: notfred
I indent whatever code I actually write. If Im writing perl or PHP, I indent that so that it makes sense. Often the HTML it generates isn't nicely indented, but that's not what I have to maintain.

That's how I do it, as well. The code is indented at my end so I can maintain and read it easily. What the HTML looks like to the end user is of very little concern to me.
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Originally posted by: notfred
I indent whatever code I actually write. If Im writing perl or PHP, I indent that so that it makes sense. Often the HTML it generates isn't nicely indented, but that's not what I have to maintain.

 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: igowerf
Do you guys indent with a tab or a couple spaces? I'm in the habit of using two or three spaces now for actual programming code (C, PHP, etc), but I still prefer tabs with HTML.
Tabs are better in theory because everyone can display them at whatever width they prefer. But one person always ends up having spaces instead of tabs and that always fubars everything for everyone else. So the nicest thing is always that you force everyone to use spaces with a standardized number. 3 is the usual. A good editor will handle spaces just like tabs, with backspacing of indents and such so it's no hassle.
 

fs5

Lifer
Jun 10, 2000
11,774
1
0
Originally posted by: kamper
Originally posted by: igowerf
Do you guys indent with a tab or a couple spaces? I'm in the habit of using two or three spaces now for actual programming code (C, PHP, etc), but I still prefer tabs with HTML.
Tabs are better in theory because everyone can display them at whatever width they prefer. But one person always ends up having spaces instead of tabs and that always fubars everything for everyone else. So the nicest thing is always that you force everyone to use spaces with a standardized number. 3 is the usual. A good editor will handle spaces just like tabs, with backspacing of indents and such so it's no hassle.

tabs are the DEVIL. Imagine 2 developers working on a piece of code one with tab spacing set at 2 one with tab spacing set at 4.
Developer A tabs once to indent and while Developer B tabs twice to match his. :(
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: fs5
Originally posted by: kamper
Originally posted by: igowerf
Do you guys indent with a tab or a couple spaces? I'm in the habit of using two or three spaces now for actual programming code (C, PHP, etc), but I still prefer tabs with HTML.
Tabs are better in theory because everyone can display them at whatever width they prefer. But one person always ends up having spaces instead of tabs and that always fubars everything for everyone else. So the nicest thing is always that you force everyone to use spaces with a standardized number. 3 is the usual. A good editor will handle spaces just like tabs, with backspacing of indents and such so it's no hassle.

tabs are the DEVIL. Imagine 2 developers working on a piece of code one with tab spacing set at 2 one with tab spacing set at 4.
Developer A tabs once to indent and while Developer B tabs twice to match his. :(
No, in that case, spaces are the devil. If both are using actual tab characters, then what shows up as 4 spaces one editor will show up as 2 on the other. In your example, devA tabs once to indent and sees 4 spaces. He gives the code to devB who looks at that code and sees a 2 space tab. He writes some more, including some new indentation, passes the file back and devA sees everything in 4space again.

A text file contains no info on how many spaces tabs should be represented by, they just contain tab characters. The problem comes when someone starts telling their editor to use a certain number of spaces instead of tabs (which is pretty hard to avoid in my experience).
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
Originally posted by: kamper
Originally posted by: fs5
Originally posted by: kamper
Originally posted by: igowerf
Do you guys indent with a tab or a couple spaces? I'm in the habit of using two or three spaces now for actual programming code (C, PHP, etc), but I still prefer tabs with HTML.
Tabs are better in theory because everyone can display them at whatever width they prefer. But one person always ends up having spaces instead of tabs and that always fubars everything for everyone else. So the nicest thing is always that you force everyone to use spaces with a standardized number. 3 is the usual. A good editor will handle spaces just like tabs, with backspacing of indents and such so it's no hassle.

tabs are the DEVIL. Imagine 2 developers working on a piece of code one with tab spacing set at 2 one with tab spacing set at 4.
Developer A tabs once to indent and while Developer B tabs twice to match his. :(
No, in that case, spaces are the devil. If both are using actual tab characters, then what shows up as 4 spaces one editor will show up as 2 on the other. In your example, devA tabs once to indent and sees 4 spaces. He gives the code to devB who looks at that code and sees a 2 space tab. He writes some more, including some new indentation, passes the file back and devA sees everything in 4space again.

A text file contains no info on how many spaces tabs should be represented by, they just contain tab characters. The problem comes when someone starts telling their editor to use a certain number of spaces instead of tabs (which is pretty hard to avoid in my experience).

I prefer spaces because they should always should up the same in any editor as long as the font is monospace (even Notepad, which uses a monospace font by default), but I see your point about custom tab sizes. Tabs would definitely work better if people have a custom/preferred tab indent size.

One of the things that annoys me with tabs is when I have a really long line of code or expression that I wrap onto a second line. If I use spaces to indent, the two lines of code will line up the way I want in every editor. If I use tabs, the two lines won't necessarily line up. It's not a big deal, but it's one of the reasons I use spaces now.
 
Jun 4, 2005
19,723
1
0
I'll keep my layout indented, after that I'll just let it go where it feels like. I'm the only one who should be touching my code, so if you thieves wanna steal it, have fun. ;)