How to Set Column Widths in a Table for an Inbox-Style Layout?
Oct 30, 2024 am 01:54 AMSetting Table Column Width
Creating a visually appealing and functional table often involves customizing the width of its columns. In the case of a basic inbox-style table, the goal is to set specific widths for the "From," "Subject," and "Date" columns, ensuring they occupy different percentages of the page width.
To achieve this customization, the CSS width property is employed in conjunction with the col element. This element resides within the colgroup element, which defines the column layout. By assigning a width value to each column, we can control its size.
Here's an example using inline CSS attributes:
<table style="width: 100%"> <colgroup> <col span="1" style="width: 15%;"> <col span="1" style="width: 70%;"> <col span="1" style="width: 15%;"> </colgroup> <!-- Column headers (<thead>) and body rows (<tbody>) go here --> <tbody> <tr> <td style="background-color: #777">15%</td> <td style="background-color: #aaa">70%</td> <td style="background-color: #777">15%</td> </tr> </tbody> </table>
This code snippet sets the table to occupy the entire page width, while defining three columns with specific percentages:
- "From": 15% of the page width
- "Subject": 70% of the page width
- "Date": 15% of the page width
The above is the detailed content of How to Set Column Widths in a Table for an Inbox-Style Layout?. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Create a JavaScript Contact Form With the Smart Forms Framework

Adding Box Shadows to WordPress Blocks and Elements

Making Your First Custom Svelte Transition

Demystifying Screen Readers: Accessible Forms & Best Practices

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts)
