A situation has arisen where a table with a large number of columns (30 columns) is being affected by the white-space:nowrap
style set on each th
tag, causing the parent div to stretch unnaturally. How can this issue be resolved and allow for a horizontal scroll within the div?
<style>
.monthly_rental_payment_daily th {
white-space: nowrap;
}
.monthly_rental_payment_daily td {
white-space: nowrap;
}
</style>
<div style="width: 100%;" class="dashboardBox" id="dashboard-monthly-rental-payment">
<div class="dashboardBoxTitle" id="dashboard-monthly-rental-payment-title">
<span>Monthly Rental Payments</span>
</div>
<div style="height:auto" class="dashboardBoxBody"
id="dashboard-monthly-rental-payment-body">
<table
class="monthly_rental_payment_daily tablesorter standardTable">
<thead>
<tr>
<th style="text-align: left;padding-right: 15px">Location</th>
<th class="left" style="padding-right: 15px">Total to be paid</th>
...
[remaining HTML code]
...
</tr>
</thead>
</table>
</div>
</div>