Search code examples
javascriptcssprime-ui

How to set PrimeUI Datatable column width


How to set PrimeUI Datatable column width? I have tried this code("http://www.primefaces.org/primeui/datatable.html"), it is working fine but i want to set width of column, please help me
Thx in advanced


Solution

  • Just add width to

    .pui-datatable thead th, .pui-datatable tbody td, .pui-datatable tfoot td

    class?

    Edit:
    
    .pui-datatable thead th:nth-child(1),
    .pui-datatable tbody td:nth-child(1),
    .pui-datatable tfoot td:nth-child(1) {
        width: 50px;
    }
    
    .pui-datatable thead th:nth-child(2),
    .pui-datatable tbody td:nth-child(2),
    .pui-datatable tfoot td:nth-child(2) {
        width: 100px;
    }