Linked Questions

0 votes
1 answer
202 views

setting element width with JS exceeds html innerWidth [duplicate]

On selecting the canvas width and height using window.innerWidth and window.innerHeight should set the canvas width and height to fit the screen that is exclusive of toolbars and everything, but ...
alittlecurryhot's user avatar
0 votes
0 answers
56 views

Fullscreen canvas [duplicate]

I have made a Google Bouncing Balls animation with Google scripts, but my canvas isn't fullscreen, I tried all the solution, but they doesn't solved the problem. Here is my TEMPLATE <canvas id="...
Egor Gunko's user avatar
477 votes
18 answers
704k views

Resize HTML5 canvas to fit window

How can I automatically scale the HTML5 <canvas> element to fit the page? For example, I can get a <div> to scale by setting the height and width properties to 100%, but a <canvas> ...
devyn's user avatar
  • 17.1k
94 votes
15 answers
224k views

HTML Canvas Full Screen

I'm playing with the following application using the HTML Canvas: http://driz.co.uk/particles/ At the moment it is set to 640x480 pixels, but I would like to make it full screen as it will be shown a ...
Cameron's user avatar
  • 28.6k
124 votes
7 answers
222k views

How do I get the width and height of a HTML5 canvas?

How can i get the width and height of the canvas element in JavaScript? Also, what is the "context" of the canvas I keep reading about?
clamp's user avatar
  • 33.7k
25 votes
3 answers
24k views

Fabric.js: Canvas with 100% width possible?

When using 'canvas = new fabric.Canvas('foo')', Fabric converts the canvas element that has a css class with width=100% attached to it into something like that: <div class="canvas-container" style=...
thomasf1's user avatar
  • 1,804
14 votes
2 answers
11k views

Setting height & width of canvas element to window.innerHeight/innerWidth causing scrollbars

This is extremely straight forward, yet I cannot figure out why it is causing scroll bars. Here is the code: CSS body, canvas, html{margin:0;padding:0;border:0 none;} canvas{background:Black;} HTML ...
BenR's user avatar
  • 2,866
2 votes
2 answers
14k views

How to make HTML5 Canvas full page size with Cocos2D

I'm new to Cocos2D-HTML5 (and HTML5 itself) and I'm trying to get the canvas to be the full size of the page. I'm confused by how few issues are documented about this on the internet, so I hope it's ...
GroovyPanda's user avatar
  • 3,802
2 votes
2 answers
6k views

How to print a canvas image at 100% page width?

My project needs to print out a canvas image that can be smaller or greater than the page width. I want the printout to maintain the canvas size if it is smaller than page width and scale if the ...
Matthew David Jankowski's user avatar
2 votes
3 answers
4k views

Get the browser viewport width and height no matter the size of the contents and without sizing to 100%?

Is there a way to get the width and height of the page viewport NOT the contents of a page without setting the body width and height to 100%? The answers I've found require the html and body ...
1.21 gigawatts's user avatar
0 votes
2 answers
4k views

Variable height, scrollable div, contents floating

I'm trying to build this web app thing (it'll eventually a stage/props/que management system for my community theatre group) and I've encountered quite a difficult problem. Apologies if this question ...
azariah's user avatar
  • 459
3 votes
4 answers
4k views

how to make content occupy whole page regardless of the screen size?

I am designing a web page for the mobile first time. I have given 100% width and height so that content will render at the full page regardless of mobile screen size. but still, as you can see from ...
Humble Dolt's user avatar
2 votes
1 answer
691 views

Drawing to canvas on mouse click is off

My <canvas> element takes up 100vw and 100vh. I want to be able to click anywhere on it and have a picture drawn there. Right now, when I click on the screen, the image does not get drawn ...
skyleguy's user avatar
  • 1,059
0 votes
1 answer
760 views

Responsive design in Intel XDK canvas game

I've made my game work on a single resolution. Now I want it to scale up&down automatically to fit the display size. When I draw upscaled images to the canvas on a big screen, they'll get slightly ...
Stefan Monov's user avatar
  • 11.6k
1 vote
1 answer
482 views

Fit canvas size to background image size, keeping its aspect ratio

I am currently developing an app allowing users to draw shapes top of an image. I am using canvas with background-image set to url("uploaded image_url"). I am having trouble getting canvas ...
Michał Kaczanowicz's user avatar

15 30 50 per page