Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
Currently, I format my html so there are no breaks in tags. I remove all indents and spaces between tags. What I end up with is code where each tag occupies one line in my html in most instances. If there are soft returns or what is referred to as the <br> tag, then my line of code breaks there and starts on the next line.
Some say they prefer indented html as it is easier to navigate. I'm going to assume that it is all a matter of how you learned and what works best for you.
I will share some valuable observations. Since reformatting all of my clients code and building new sites using my method of formatting, I've seen an overall increase in the ability to secure and obtain pageoneresults.
How do you format your code? Why do you format that way? The reason I posted in this forum is because I'm an FP junkie. Hiss and boo all you want, but I know all the little secrets of the program! ;)
P.S. Validation is a must for me as it has now become second nature when developing sites. Yes, FP is capable of producing valid html in the right hands.
I write code using an indented style - especially when the if-then-elses get nested ten deep. Indentation makes the code structure visually clearer, and aids in finding problems. If I'm hand-coding HTML, I may or may not indent the code; I mostly use indentation for scripting and programming languages, but may revert to it for "tricky" tables or complex layouts in HTML.
Publishing to the web, however, is an altogether different matter; Once the code is debugged and tested thoroughly, then every single unnecessary character is mercilessly eliminated (I use an automated tool to do this). This regulary results in files 10% to 25% smaller than before, and that means faster page loads, fewer bills for bandwidth overages, and less stress on the server.
This I believe to be a good compromise, allowing for readability without adding excessive weight ("white matter?") to documents (for HTML e-mail, we strip out all carriage returns, tabs, and non-content spaces after the final draft is approved).
Since reformatting all of my clients code and building new sites using my method of formatting, I've seen an overall increase in the ability to secure and obtain pageoneresults.
That would really be surprising. I do understand why SEs might favour valid HTML over invalid HTML. But I cannot think of any reason why they would prefer one code formatting style over another since the HTML spec clearly states that whitespace does not matter.
Could you explain in more details how you measured that increase?
2 hard returns after <head>
<divs> seperated by 2 hard returns
<p>'s and </p>'s in same line and sandwiched immediated after <div>
I hardly ever use tabs and just use line breaks to seperate the "chunks", mainly <head> and <body> and seperate <divs>
I've found PHP great to alter "foreign" information to a more friendly code layout. It's handy for simple things like stripping out another webmasters code formatting "preference" and re-arrange it to your liking.
If all info came pre-formatted and in the correct format, how much easier would it be! :)