The difference between a div and a table

Source: Internet
Author: User

1: The difference between the speed and the loading method the difference between div and table is not speed, but loading mode, speed can only refer to the network speed, if the speed is fast enough, there is no difference: the way to load the div is read and load, encountered not encountered when the content of the same load div, read how much load The table is loaded when it is finished and is encountered After reading the
Previously, the contents of the table were not loaded, or the transmission was interrupted (Document.onload () event) because the table involved multiple rows of multiple columns, so only if all the table contents were loaded, ie just know how to display 2: The difference in Web application if the page is added to the table, then the entire page must be read to load if the page ends with a div, without any effect on the usability of 3:div and table layouts in large Web sites there is no merit in the Div and table itself. The so-called Web Standard is only recommended is the correct use of tags, such as: Div for the layout, and table is actually the two-dimensional data. Let table do the thing, not to say that the page does not appear to be how much cow. The advantage of using div for typesetting is that I don't say that everyone should be more clear. Div is the standard, is the trend, but does not mean that all the pages are suitable to use it to do. China's portal and foreign countries have a very big difference, Chinese netizens do not like the information of less pages, Yahoo to the Chinese page content on more than a lot, and the last time to a concise page after the decline in access to a strong so that not a few days and then changed back. Officially because of China's national conditions have created Sohu, Sina such portals. Why are div not suitable for them? Here are a few things I can say: Thin code: Everyone says that Div's layout is streamlined, but the code saved with Div instead of table is occupied by CSS (style), which is mostly used to control the layout of the Div. Then you will say, CSS can be put on the external reuse ah, to get the answer to this question, please look down. Reusability and Downloads: Unified use of a. CSS style sheet file, can be modified once, the effect of the whole station modification, so that the cost of maintenance is lower. But please change a point of view, if all the pages in the load to access a file, then the daily download of the file, especially in the Sohu, Sina website platform will reach hundreds of millions of times, which requires a lot of front end of the Web server to do support, the background of the cost of virtually also improved a lot. If the background support is not done, then the page will appear a flower screen, the previous work is also wasted. Many people will ask that the odds are too small. The work we do is to avoid these one or two accidents, and if it happens, the consequences for the portal will be disastrous. HTTP communication: A unified style sheet file takes the form of an external call, so that each time a single page is loaded, the server's HTTP request server will be incremented one more time, which can be very expensive for the front-end Web server. And the original long time is the CSS and JS written in front of the page (you can see Sohu and Sina pages, mostly in this form), rather than as an external call form, but also toTry to avoid adding consumption to the server. Page Caching: Each time a user accesses a page, it will be saved in the browser cache for a certain amount of time to ensure that the next time the user accesses the page, the page display speed is greatly improved. And each modification will make the page re-download, for each external imported style file is also the case, if the CSS file modification, then the visit to each page of the site will be re-downloaded, and the previous way to write style on the page, only the modified page needs to be re-downloaded. Compatibility: For CSS (style sheets) Not all versions of all browsers support very well, such as IE5 the previous browser for CSS support is not very good. And now there are a few users of the previous version of IE5 browser, so that in the process of page production needs to be tested for different browser versions to ensure compatibility, and virtually add a lot of work (at least I touch the developer to make a DIV page than the table page standard time longer). Crosscutting and ductility: crosscutting-Traditional layout in order to make the page download faster, the page into a number of blocks from top to bottom, but often using div layout of the page will appear such a situation, because each block of the middle column or other columns of the content of the column is not fixed on both sides of the column is not adaptive, and appear white. Above we are just discussing the availability of a particular technology in a particular area, not the technology itself. Saying so much is not to say that Div is a bad layout, but rather that we should look at the role of table in a large, content-based portal, rather than in the same way. The reason for the layout of the div is not in the large Web site application, not to say that the portal does not use Div is technologically backward, is the person inside is not forward-looking, but a variety of reasons to decide. NetEase uses div all the way because the content is not their main direction. For other portals, such decisions are time-tested. It's just that the time is not ripe yet. 4:div+css and now I think that DIV +css is not literally the meaning of the simple, and there is a double intrinsic meaning: 1, the structure and performance of the separation, with the DIV to complete the structure, with CSS control performance, this brings a lot of benefits, DIV streamlined page, improved flexibility. CSS designers can avoid the repeated nesting of Div, which greatly improve the page loading speed, as well as the maintenance of the site. 2, the use of Div to match the reason of CSS, the core of CSS is "box model", and no label can be better than div interpretation of the essence of "box model", table structure is too complex, and can not do this very well, although TABLE+CSS is also a choice, But don't forget the div there is another advantage, floating cascade, and table layout of the site can not be verified by the Internet. In fact, the benefits of div far more than these, such as flexible layout, user-defined layout, Div showsIncredibly flexible, and the semantic structure is more friendly to search engines than table, not to mention cross-platform applications. DIV+CSS provides us with an elegant and prescriptive technical framework that allows us to achieve more aesthetically pleasing pages with minimal duplication of effort, thereby improving the efficiency of the entire team and even changing the long-standing inability of web designers and web programmers to work synchronously.

The difference between a div and a table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.