mkoryak/floatThead

Center Floating Head in Container

burgoyne opened this issue · 5 comments

So I am attempting to center my table inside it's div. I am centering the table by setting margin: 0px auto. In my project, the table is centered, but the header is not (it is off by 35px, which is the size of padding on my container div).

After inspecting it, it seems that the table element that floatThead creates for the header, is outside my container div... The actual table is inside though. So this results in my table being properly centered, but my header being slightly offset to the right.

Here is an image showing the offset (data blocked out):
table head padding

I attempted to duplicate the issue with a fiddle, but it works fine! Has anyone had this issue where they're newly generated table for the header is outside the containing div?
https://jsfiddle.net/skx1u94d/1/

I noticed that other thread, but it does not seem to be the same issues. My problem seems to be caused by the generated table being placed outside the container. I assume it is a bug, potentially a configuration issue.

Trying to better explain:
If you look at my fiddle, there is a div with overflow and padding rules. The table is inside that. When floatThead generates the new table for the floating header, it is also inside that div.

On my project, I have a div with overflow and padding rules (identical to the fiddle), When the new table is generated by floatThead, it is positioned above/outside that div. So my margin 0px auto rule is not constrained inside the div (as my posted image states). Im hoping this has been seen before, as I have been struggling with it for hours now.

Looking more into it, it does seem to be the same issue. I am going to try to resolve this based off of those answers.

duplicate of #437

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.