writer1 Posted July 18, 2013 Share Posted July 18, 2013 (edited) Hi, I am a beginner so not sure if this should be placed here or in CSS? Based on this example: http://jsfiddle.net/pmw57/as4UR/ ,have a canvas element, 640X640. How do you center this canvas so it appears in the middle of the screen? Currently it is displaying 0,0. Thank you for your help. writer1 Edited July 18, 2013 by writer1 Link to comment Share on other sites More sharing options...
justsomeguy Posted July 18, 2013 Share Posted July 18, 2013 Give it the CSS properties display:block and margin: 0 auto; Link to comment Share on other sites More sharing options...
writer1 Posted July 18, 2013 Author Share Posted July 18, 2013 (edited) Hi, Thank you for your reply and helpful suggestions. I have done some more online searching and came up with the following which works: canvas{ border:1px solid black; position: absolute; top: 50%; left: 50%; ; margin-top: -320px;} Seems to work OK. Edited July 18, 2013 by writer1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now