Home > Article > Web Front-end > How Do I Set Fixed Column Widths for HTML Table Cells (``) in Different Bootstrap Versions?
In order to set a fixed width for table data cells (
For Bootstrap 4.0 and subsequent versions, it is not recommended to rely on col-* classes to control column width due to inconsistencies across browsers. Instead, the following approach is recommended:
<tr><br> <th> <th style="width: 25%">Col 2</th><br> <th> <th style="width: 8.33%">Col 5</th><br></tr><br>
Within Bootstrap 3.0, the col-md- class should be used, where represents the desired column width in divisions of 12. For example:
<tr></p> <pre class="brush:php;toolbar:false"><td>
For Bootstrap 2.0, the span class is utilized to control column width, with indicating the number of columns desired. For example:
<tr></p> <pre class="brush:php;toolbar:false"><td>
It is important to note that the width should be set on
The above is the detailed content of How Do I Set Fixed Column Widths for HTML Table Cells (``) in Different Bootstrap Versions?. For more information, please follow other related articles on the PHP Chinese website!