The difference between a div and a table as a layout

Source: Internet
Author: User

This article describes the div and table page layout differences and relations, generally speaking, table development fast, easy to control, browser compatibility is better, another part of the view that Div is good, is the future development trend, the main reason please see the detailed introduction below.

Differences and linkages between div layout and table page layouts

Now for Web page production is the choice of traditional table or new Div, there are differences. Part of the said or use table good, fast development, easy to control, browser compatibility is better; the other part thinks that Div good, the future development trend, mainly is the following reasons:

The Div+css layout saves page code and the code structure is clearer than the table layout.

DIV+CSS development is faster than table, and the layout is more accurate, but the handwriting code significantly increase the DIV+CSS layout, make the site layout changes easier.

The DIV+CSS layout is adaptable to a wide range of future client requirements.

DIV+CSS layouts save space and site traffic for your site. These are the benefits of Div.

Div has so many benefits is not some heart, decided to learn it. div layouts and table have strengths, and they are often used interchangeably.

I feel the right to meet the standard design idea is: use div and other layout elements to make the layout of the page design, positioning, color blocks, pictures and so on. Use such elements as Table,ul to display the data that needs to be displayed on the page. Because Div will not be like table, in IE will be the entire table after downloading all the content (Firefox will not), so the layout with table is obviously inappropriate, especially when the amount of data is large, in IE under the table will find much slower. And the div is much better. Of course, Div also plays the role of collating data.

Div is used for layout, table for displaying data, which is now the most basic design principle.

1:table can be embedded in the div. Conversely div can be embedded table??

Of course you can.

Div definition

Represents a piece of area that can display HTML.

Specifiesacontainerthatrendershtml.

Comments

This element is available in InternetExplorer3.0 and above versions of HTML, and is available in scripts InternetExplorer4.0 and later.

This element is a block element.

This element needs to close the label.

Sample code

The following example uses two DIV elements to align two pieces of text differently.

    1. <DIV>
    2. This text represents a paragraph. You can put your HTML or text here.
    3. </DIV>
    4. <DIVALIGNDIVALIGNDIVALIGNDIVALIGNDIVALIGNDIVALIGNDIVALIGNDIVALIGN=CENTER>
    5. This text represents another paragraph where the text is centered.
    6. </DIV>

Div itself is container nature, you can not only inline table can also embed text and other HTML code.

is 2:div the same as table?

Div has the same function as table, but the div supports XML better and is more flexible to use, so it is recommended as a new way to page layout.

3:divtable which speed is fast?

Div is relatively fast, the content of the Web page needs to be relative to a whole block of content downloaded and then displayed. Using a div layout is a relatively small range of independent, while using a table layout typically forms nested layers of tables to form a larger download range.

The difference between a div and a table as a layout

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.