CSS-Only Table Creation: Overcoming IE Limitations
The question posed here seeks a method to generate a table solely using HTML's
To address this issue, the following CSS classes can be utilized:
.div-table { display: table; width: auto; background-color: #eee; border: 1px solid #666666; border-spacing: 5px; /* cellspacing:poor IE support for this */ } .div-table-row { display: table-row; width: auto; clear: both; } .div-table-col { float: left; /* fix for buggy browsers */ display: table-column; width: 200px; background-color: #ccc; }
These classes enhance compatibility by specifying the correct display properties for the table, table rows, and table columns.
Updated Code Snippet:
The following HTML and CSS code demonstrate the updated implementation:
HTML:
<body> <form>
By using these CSS classes, the table is rendered properly even in IE7 and earlier versions.
The above is the detailed content of How Can I Create a CSS-Only Table Compatible with Older IE Browsers?. For more information, please follow other related articles on the PHP Chinese website!