Datatables generator base css max-width: 980px moving table away from left side

Datatables generator base css max-width: 980px moving table away from left side

crcucbcrcucb Posts: 43Questions: 12Answers: 0

I noticed that when I use the files from the download generator, the datatable is no longer along the left side of the page and is wider than the desktop browser

The generator-base.css contains the following:
body.dataTables div.container,
body.jqueryui div.container {
max-width: 980px;
margin: 0 auto;
}

When I remove the line: max-width: 980px; the DT seems to look fine in the desktop browser
Why does including the above line cause dt to shift ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,743Questions: 1Answers: 10,712 Site admin
    Answer ✓

    Hi,

    It isn't the max-width that is causing it to move away from the left of the page, but rather the margin: 0 auto;. That sets the left and right margins to auto, which basically balances them, resulting in a centre aligned element.

    You see that effect with max-width applied, since without it the container is 100% width.

    Do whatever you want with it :). Generator is a quick start tool and not designed to be a full page designer. If you want the table to take the full width of the page regardless of the browser window size, just remove the max-width.

    Allan

Sign In or Register to comment.