[thelist] Why do we say what we say?

Jon Hughes jon at phazm.net
Thu Oct 25 08:45:43 CDT 2007


> Something else that the validator will happily ignore is code
> indentation.
> Personally, I use tabs, but some people like to use spaces, in various
> amounts (2, 3, 4 or sometimes even 6 spaces per indentation). Other
> developers tend to close their elements after the indentation, e.g.:
> 
> <ul
>    ><li>Item 1</li
>    ><li>Item 2</li
> ></ul>
> 


Eek.

I have no idea if any browsers would choke on that, but I wouldn't be
surprised if some did.

I actually prefer to keep my HTML non-tabulated. For me, it makes it much
easier to read.

Javascript, PHP and ASP, however, I tabulate with tabs:


Function foo(bar) {
	var bar = "foo";
	alert("foo"+bar);
}

Mostly because it gets to convoluted with error checking and whatnot. If I
was still doing tables, I would still tabulate my HTML :)


Regarding spacing, as long as you have it like this:

<ul>
	<li>Item1</li>
	<li>Item2</li>
</ul>

You will be fine.  The problem comes when you have:

<li>Item1
</li>


One issue I get when I collaborate with back-end programmers is things like
this:

<li>Item

<?php if (foo=bar) { ?>

Foo

<?php } ?>

</li>

Which outputs (if foo=bar, of course)


<li>Item



Foo


</li>



The code should be written as such:


<li>Item<?php


If (foo=bar) {

?>Bar<?php


}

?></li>


This will result in:

<li>ItemBar</li>



 - Jon




More information about the thelist mailing list