How to set table width to 100% in CSS

How to set table width to 100% in CSS

Tester2017Tester2017 Posts: 145Questions: 23Answers: 17

As the width attribute on the table element is obsolete I would like to know where in my CSS I can set the table width to 100%.

As stated in this example https://datatables.net/examples/basic_init/flexible_width.html:

[..] Typically this is done by assigning width:100% in your CSS, but this presents a problem for Javascript since it can be very hard to get that relative size rather than the absolute pixels.[..]

Answers

  • Tester2017Tester2017 Posts: 145Questions: 23Answers: 17

    OK, already resolved; changing width=100% in style="width:100%"resolves the error message.

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin

    Yes - that's spot on.

    Allan

  • sivapictuscodesivapictuscode Posts: 1Questions: 0Answers: 0
    edited November 2019

    <style>
    td{
    word-break: break-all !important;
    }
    </style>

This discussion has been closed.