Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6887187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:51:15+00:00 2026-05-27T05:51:15+00:00

Canvas with absolute position doesn’t work as you can see here: http://jsfiddle.net/733zs/1/ (Tested in

  • 0

Canvas with absolute position doesn’t work as you can see here:
http://jsfiddle.net/733zs/1/ (Tested in Firefox and Chrome) The Rectangle should have a size of 500×500 pixel.

Is there a way to make it work, without setting width and height manually? Or do I have made any mistakes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:51:16+00:00Added an answer on May 27, 2026 at 5:51 am

    You must set width and height manually.

    This can be done through JavaScript onresize event – which is fine because you almost always need to redraw your canvas surface onresize anyways.

    EDIT:

    From W3 spec, here is the canvas DOM interface:

    http://www.w3.org/TR/html5/the-canvas-element.html

    interface HTMLCanvasElement : HTMLElement {
               attribute unsigned long width;
               attribute unsigned long height;
    
      DOMString toDataURL(in optional DOMString type, in any... args);
      void toBlob(in FileCallback, in optional DOMString type, in any... args);
    
      object getContext(in DOMString contextId, in any... args);
    };
    

    The canvas element has two attributes to control the size of the
    coordinate space: width and height. These attributes, when specified,
    must have values that are valid non-negative integers. The rules for
    parsing non-negative integers must be used to obtain their numeric
    values. If an attribute is missing, or if parsing its value returns an
    error, then the default value must be used instead. The width
    attribute defaults to 300, and the height attribute defaults to 150.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here are my code snippet: <canvas id =compound_area style= position: absolute; border: 2px hidden;
How can I find the absolute position of the paper/canvas when using the Raphael
How can i draw a view on a canvas by giving the x,y position
My code is below. I also have it at http://jsfiddle.net/S2JHa/ I do not understand
For years, Visual Studio.NET has offered absolute positioning for ASP.NET, whereby you can drag
Here's the code I currently have. <!DOCTYPE html> <html> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8/>
Can you superimpose canvas over video in IOS safari (IPAD)? I tried adding text
I' try to drawing canvas using example2 taken from http://dev.opera.com/articles/view/html5-canvas-painting/ . It works on
<div id=Zoom style=background-color: blue; top: 1077px; left: 378px; position: absolute; display: block;> Send <div
I have similar issue with layers as described here html5 - canvas element -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.