Why is table layout not recommended?

Source: Internet
Author: User

Why is table layout not recommended?

Part of content Reprinted from: http://www.html5tricks.com/why-not-table-layout.html

When I first came into contact with html, it was easier to use table for page layout. However, in the actual project development process, we do not recommend table layout, for the following reasons:

Benefits of table

In some cases, using table is completely appropriate, appropriate, and accurate. For example, use table as a table. If you cannot determine whether to use the table, I have several questions:

  • "Do the information of these rows or columns share an attribute? For example, if each row shows a student, all students have a 'name' attribute ."
  • "If I change the order of these rows or columns, does it still make sense or have the same effect ?"
  • "If I convert a row into a column or a column into a row, does it still make sense or have the same effect ?"

If the answer is "I guess ...... Maybe not. For more information, see "Why is table layout inferior to HTML + CSS ".

How to make two spans display the same row without table

When layout HTML and CSS, you may need to put the control (span, div, etc.) on the same line. refer to the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Parent layer overflow-x: hidden can avoid line breaks when the form size changes. After CSS control of div and span, you can avoid using tr of table for page layout, and the page code is clearer.

Related Article

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.