HTML canvas resize and mouse coordinates

If you are using canvas with predefined width and height you probably know that resizing the window and canvas result in size not always the same as the screen.

This is annoying especially for retrieving mouse coordinates exactly matching with the canvas size instead of the window size.

Here is an idea on how to stretch the canvas and still keep the coordinates correct for the original dimension:

Facebooktwitterredditpinterestlinkedinmail

Image (of unknown size) vertically centered inside a div in css

You may have encountered the complexity of centering an image inside a div vertically similar to what was possible with table cell (<td>) and valign property (valign=middle)

Here is an example on how to do it with CSS

image

 

image

 

image

Facebooktwitterredditpinterestlinkedinmail

HTML – website redirect with frames

A clear way to redirect to another website is to use frames. Here below a simple code to put in your index.html:

For a better result a title and a shortcut icon can be added to have a result closer to the final website. Here below the new example code:

 

Facebooktwitterredditpinterestlinkedinmail