Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you mix % and px to align a table?

Tags:

html

css

I am trying to align different tables with different amount of columns so the first two columns are align and the rest are independently align but using % it is very difficult and when resizing window it losses alignment.

That is why I was trying to align mixing with % and px on td, ex.

<table>
  <tr>
    <td width="100px"></td>
    <td width="100px"></td>
    <td width="50%"></td>
    <td width="20%"></td>
 </tr>
</table>
<table>
 <tr>
   <td width="100px"></td>
   <td width="100px"></td>
   <td width="70%"></td>
 </tr>
</table>

But As does not look logical it does not seem to work.

Is there any way to get this working or an alternative?

like image 452
Amra Avatar asked Dec 04 '25 10:12

Amra


1 Answers

You can... But what would you expect this to do? Most of the time, your table will have extra space or not enough space, and won't be able to honor one or more of your requested widths. Leave a column with the width unspecified...

like image 60
Hackles Avatar answered Dec 07 '25 11:12

Hackles



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!