How to set table column width to django admin list_display?

I want column foo (TextField 2500 chars) to have a width of 30% in admin view.

Yet whatever I try, the columns widths remain equal (50% / 50%).

td.foo {width: 30%;} has no effect at all.

admin.py:

class FooAdmin(ModelAdmin):
    list_display = ['foo', 'bar'] # foo column width should be 30%
    class Media:
        css = {'all': ('css/custom.css', )}

custom.css:

table {
    table-layout: fixed;
}
td.field-foo {
    width: 30%;
}

Working minimal html example of desired result:

<!DOCTYPE html>
<html>
<head>
<style>
table {
  table-layout: fixed;
}
td.foo {
  width: 30%;
}
</style>
</head>
<body>

<table border="1">
  <tr>
    <td class="foo">30% width</td>
    <td>Cell 2</td>
    <td>Cell 3</td>
  </tr>
</table>

</body>
</html>
Вернуться на верх