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.