Documentation of attempts and images of the described problem:
I am trying to resize a table in Bootstrap . Bootstrap works just fine, and even my table works mostly fine. The problem I encountered is that when you resize the view port (whether itβs a desktop window or rendering a page using a mobile phone screen), the table will not be resized in any reasonable way. It resizes, but not relative to its original position. It shrinks in place and loses its margin position with other elements on the page.
As you can see, I tried several different methods represented by comments. I posted at least 40 browser tabs that were looking for a viable solution. There is a little something that I donβt grab, and a good push in the right direction would be greatly appreciated.
What do I need to do to facilitate this field so that the table stays at the top and left of the contents above it and the view port on the left?
See my answer below for a solution for both conversion and maximum problem.
Incomplete jquery code that I use:
$(window).resize(function() { var ww = $(window).width(); var hh = $(window).height(); var tt = $(".gametable").width(); var scle = 0.0;//parseFloat(tt) / parseFloat(ww); if (ww <= 688); { scle = parseFloat(ww) / parseFloat(tt); //$(".gametable").css("transform", "scale(" + scle.toString().substr(0, 4) + ")"); $('.gametable').css({ '-webkit-transform' : 'scale(' + scle.toString().substr(0, 4) + ')', '-moz-transform' : 'scale(' + scle.toString().substr(0, 4) + ')', '-ms-transform' : 'scale(' + scle.toString().substr(0, 4) + ')', '-o-transform' : 'scale(' + scle.toString().substr(0, 4) + ')', 'transform' : 'scale(' + scle.toString().substr(0, 4) + ')' }); } $(".log").html($(".log").html() + scle.toString().substr(0, 4) + "<BR>"); // $(".gametable").width($(".gamerow").css("width")); // $(".gametable").height($(".gamerow").css("width")); // $(".gametable").css("transform", "scale(0.75)"); $(".gametable").css("position", "relative"); $(".gametable").css("top", "0"); $(".gametable").css("left", "0"); $(".gametable").css("padding", "0"); // // $(".gamediv").css("position", "relative"); // $(".gamediv").css("top", "0px"); // $(".gamediv").css("left", "0px"); // $(".gamediv").css("padding", "0px"); });
An exact description of the declared behavior can be found in the following figures:
The table is to the left of the screen when both the window and the board have the same width: 688 pixels.
But when using the above code, the table is compressed, but does not maintain position. This is my question. How do I do this not to make this margin?
We repeat. When I compress the table using the conversion method above, it creates an unwanted edge on the top edge and to the left of the table. What do I need to do to facilitate this margin so that the table remains above and to the left of the content above it and the view port on the left?