Jump to content
writer1

Centering Canvas

Recommended Posts

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 by writer1

Share this post


Link to post
Share on other sites

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 by writer1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...