I’ve looked at this question:
Centering a percent-based div
But my attempts are fruitless. I dont quite understand how the answer in that question makes sense or how to do it with 100% widths. Basically I have a dynamic rendered page that has two divs – both are set to 100% width and 100% height so that the entire output is captured. So if the two divs are different lenghts, I want to center the div to the body:
<body>
<div id="first">Longer Name</div>
<div id="second">Name</div>
</body>
Current output:
OUTPUT LONGER
OUTPUT SHORT
Desired output:
OUTPUT LONGER
OUTPUT SHORT
div CSS:
height: 100%;
position: relative;
width: 100%;
body CSS:
margin: 0;
padding: 0;
Percentage based divs are required due to the dynamic nature of the output.
EDIT
I should make it clear the output is a ton of tables. The example I put was to show how I want it to center. The output is NOT text. Basically one table width could be 120px and I need to center it in the body (which would be the width of the longer div, which could be 1500px).
1 Answer