What has to be a code the Internet - pages? Readability vs size. Part 1. HTML
This article, first of all, will be interesting to beginners or not really skilled site builders, but it is possible, as the people tempted in this hard business will find couple of interesting councils too.
Never it will turn out to make everything as there is a wish … It, of course, is a little unfair, but it is the fact - the ideal websites do not happen and will never be! Constantly it is necessary to choose: originality of navigation and design or a usability, content, small and easy scripts or safety, resistance of the website to breaking optimized or interesting to the reader. And it not everyone - this list can be continued indefinitely!
That`s it about one such dilemma also I want to argue today. I think that many site builders when developing the creations faced such here problem: what to prefer? What it will be better for the website, visitors and the developer? Readable and easy code or small size of pages in understanding and, therefore, and higher speed of loading?
In general is a question eternal! Why? But because it is always necessary to offer something!
Many, unfortunately, make the unambiguous choice for the speed of loading and write a code nearly to one line. First I too so did, but over time my code became more readable. In purely html pages it is possible to deal with a code since it is easier to understand that where, there are no variables, cycles etc. quickly enough. Also it is possible to offer readability, to write the table, tr and td tag on one grinding … Also it seems that everything is clear: there is a table, here a line, here a column. However the task strongly becomes complicated at strongly loaded code and nested tables (and repeatedly enclosed) and at the same time in one table such CSS style, in next other CSS style and if at the same time parts of the page are in different files (those who program for php, I think, will understand as well as why to have a half of html of a code of the page in one file, and a half in another). And here you will already hardly quickly understand even an own code. I will explain on a personal example.
On we wash the website there was such glitch: in the Opera and IE everything is normal, and in Mozille for some reason the " pages; jumped “. In particular, the right column was extended strongly in height, and central and left of - for it were somewhere in the middle.
Ya looked for nearly two days a mistake! Did not find! It was complicated just by the fact that html a code was quite big and loaded. Then I spat and decided to make first of all - navsy a code readable since. in due time much it changed, added nested tables, cleaned one, added the third, transferred from one place to another the fourth, etc. And then to spend minutes 20 - 30 to make a code readable, to add excess gaps and transfer to a new line where it is necessary - me was a reluctance.
And here I just made a code readable! The size of pages at the same time at me increased even almost by 21 kilobytes. While already nearly 75 it weighed before.
I as a result of everything for half an hour found a mistake! Just in one place at me height was specified as a percentage, namely in this place it was necessary in pixels. Mixed, thought that this tr belongs to one table, and it appeared, to another! As you can see, the mistake was elementary and it was heavy to be found only from - for an unreadable code!
Yes, I understand that the code constantly changes, something is supplemented, something cleans up, but are not lazy at the same time to do a code readable! Every time, after each modification.
Since we told a code only about html - that it were still florets, and about berries watch the second part.