Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center content without table #20

Open
feklee opened this issue Jun 3, 2012 · 0 comments
Open

Center content without table #20

feklee opened this issue Jun 3, 2012 · 0 comments

Comments

@feklee
Copy link
Owner

feklee commented Jun 3, 2012

Just found out that specifying min-width and min-height for HTML avoids the problem that content centered in a certain way is not fully scrollable when the browser window is smaller than the content.

Example CSS to center body within HTML, if absolute size is known (which is the case here):

 html {
     width: 100%;
     height: 100%;
     margin: 0;
     padding: 0;
     position: relative;
     min-width: 500px;
     min-height: 100px;
 }

 body {
     position: absolute;
     margin: -50px 0 0 -250px;
     left: 50%;
     top: 50%;
     border: 1px solid red;
     width: 500px;
     height: 100px
 }

But don't forget: Test if this works in IE7 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant