Reputation: 1173
I have a .container div that I want to center on the page.
Unfortunately, the div is supposed to fit the table that is in inside. So if the table is at 75% of the page, I want the .container
to be at 75% as well.
My .container looks like this:
.container{
display:inline-block;
background:#FFF;
height:500px;
max-width:80%;
}
I made a JSFiddle here.
Thanks for all help!
Upvotes: 1
Views: 71
Reputation: 240868
Adding text-align:center
to the parent of an inline-block
element will center it.
In this case, it would be:
body {
text-align:center;
}
Upvotes: 1