UPDATED: Here is a real-life scenario I am facing:
I am trying to adjust the width of columns in my table using inline CSS. Let me provide you with an example:
The Table
was initially set to 100%
, like this: <table width=100% ...>
The total number of columns in my table is 14 and some columns have a colspan = 2
.
The issue I am experiencing with my HTML/CSS is that once a row cell is filled with content, the width of the column header also changes. The first column has ample space, but the 2nd column (with colspan = 2
) shrinks due to the content. This creates a layout like the image below:
https://i.stack.imgur.com/i8CZB.png
In the provided image, it can be seen that the first column should shrink slightly while the Prev QA
column should expand.
My objective is to reduce the width of the first column and increase the width of the 2nd column. However, no matter what changes I make or how I add width
to td
, it does not impact the layout. Does anyone have a solution for this? Thank you in advance.
Table:
<table width=800...>
First row:
<tr border=0><td style='cellspacing =0; ' border=0 colspan=12 style='font-family: Calibri;Bold; font-size: 14pt; color: white; font-weight:bold; background-color:#0d384f;' width=100%>Title</td><td style='cellspacing =0; ' border=0 colspan=2 align='right' style='font-family: Calibri;Bold; font-size: 14pt; color: white; font-weight:bold; background-color:#175072;'>title2</td></tr>"
Second row (Header row) (need to change)
<tr BGCOLOR=\"#1b629b\"> <td style= \"font-weight:bold\";width=100><font color=white><Center> Client Name</Center></td><td style= \"font-weight:bold\"><font color=white><Center>Engagement</Center></td><td style= \"font-weight:bold\"><font color=white><Center>DataFreq</Center></td><td style= \"font-weight:bold\";colspan=2><font color=white><Center>Prev QA Account Balance </Center></td><td style= \"font-weight:bold\";colspan=2><font color=white><Center>Current QA Account Balance</Center></td><td style= \"font-weight:bold\";colspan=2><font color=white><Center>Prev QA ATB Balance </Center></td><td style= \"font-weight:bold\";colspan=2><font color=white><Center>Current QA ATB Balance</Center><td style= \"font-weight:bold\"><font color=white><Center>Max Admit Date </Center></td><td style= \"font-weight:bold\"> <font color=white><Center>Max Charge Date</Center></td><td style= \"font-weight:bold\"><font color=white><Center>Max Trans Date </Center></td>")