20 Control Table Mastering tables

Source: Internet
Author: User
Control

You think you already know how to make a form. Of course, you understand table , tr , td and th label, already know rowspan and colspan attribute. You can make a cute little plywood coffee table, but don't you want to know how to make a nice solid wooden form that can withstand the weight of an elephant glass sheet?

Longitudinal regression

Table rows Cause table columns to look stupid. They assume all the work, and the table is only built with rows, excluding columns.

Fortunately the enthusiastic column of hope came colgroup and the col label.

The above two tabs allow you to define the columns and add the styles you want, and when you want to arrange columns and use different colors, you need to increase the style of individual cell cells.

Here's an example:

<table><colgroup><col /><col class="alternate" /><col /></colgroup><tr><td>This</td><td>That</td><td>The other</td></tr><tr><td>Ladybird</td><td>Locust</td><td>Lunch</td></tr></table>

The style of class "alternate" is applied to the second column or the second cell with no rows.

You can also colgroup col use span attributes, methods, and the rowspan like colspan .

The colgroup example <colgroup span="2"></colgroup> combines the first two columns by using the number of rows that have a column group defined. When span appears, there is colgroup no need for a col label.

colit is advisable to use span in the label, which may be applied as follows:

span="2" class="alternate" /></colgroup>...

The ' alternate ' attribute is applied to the last two columns.

The only style you can add to a column is borders, backgrounds, width and visibility.

IE has a better performance than any other browser because it is better than CSS in terms of tables, for example, color but, because of the original, the only reason is that it plays a quirky role, for detailed explanations, let Hixie.

Summary and title interval

In summary and ease of use considerations, often add summary summary and Caption caption descriptions in table

Use summary attributes to add a summary to a table that does not appear and can be used to help tables that do not have a display effect.

captionThe label is table added after the start tag. It will be shown on the table and can be used in CSS to caption-side define, top right bottom and left , even though IE regardless of these.

summary="The mating habits of locust, showing how many use protection and how many have a cigarette afterwards"><caption>Locust mating habits</caption>...

Headers, footers and the quest for the scrolling table

thead, tfoot and tbody allows you to divide the form into the head, the bottom and the body part. This is useful for large tables, when printing for a column, the header and bottom rows can appear on each page.

Three elements must pay attention to the order thead - tfoot - tbody .

<table><thead><tr><td>Header 1</td><td>Header 2</td><td>Header 3</td></tr></thead><tfoot><tr><td>Footer 1</td><td>Footer 2</td><td>Footer 3</td></tr></tfoot><tbody><tr><td>Cell 1</td><td>Cell 2</td><td>Cell 3</td></tr>...</tbody></table>

In Mozilla browsing, you can also set the TBODY element to scroll scrolling by using a style overflow:auto;max-height:[随便] . You can find that the head and the bottom remain in place, and the scroll bar appears to the right of the body part. You must use max-height attributes, because IE does not recognize this attribute, so it is safer than using height attributes.

Note: Back to browser differences, this time IE no clue to the head and bottom, although appearing in the table, will not appear on each printed page of the head and bottom, not to mention the provision of scrolling tables.

Be wary of using roll to table. Although it is very useful, most users do not use them, users believe that the online performance of data is the only valid data.







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.