I am working on a dynamic table that is created based on user inputs to display tabular data. I want to set a fixed height for all cells, regardless of their content. Is there a way to ensure that all cells have a height of 30px, even if they contain text or are empty?
Below is the CSS code I am currently using:
table {
width: 90%;
height:100%;
}
table th, table td {
border: 1px solid gray;
height:30px !important;
padding: 9px !important;
width: 16%;
}
The table is generated using the following PHP code snippet:
foreach ( $this->rows as $i => $row ) {
$tbody_tr = NHtml::el ('tr class="data-row-' . $i . '"');
foreach ( $this->fields as $field ) {
$tbody_tr->add(NHtml::el ('td')->class($field['name'])->setHtml(@$row[$field['name']]));
}
Even with this setup, when a cell contains text, its height still increases. Any suggestions on how to address this issue?