How can I center

Since ul and li elements are display: block by default — give them auto margins and a width that is smaller than their container. If you’ve changed their display property, or done something that overrides normal alignment rules (such as floating them) then this won’t work.

How to make canvas responsive

To change width is not that hard. Just remove the width attribute from the tag and add width: 100%; in the css for #canvas Changing height is a bit harder: you need javascript. I have used jQuery because i’m more comfortable with. you need to remove the height attribute from the canvas tag and add this script: You can see this fiddle: https://jsfiddle.net/1a11p3ng/3/ … Read more

Why onbeforeunload event is not firing

The onbeforeunload event is not cancel-able, because of security reasons, but if an event handler function for the onbeforeunload event returns a string value, this text will be shown in a confirmation dialog box, where the user can confirm whether he wants to stay or leave the current page. Note that event listeners cannot be registered for the onbeforeunload event with the addEventListener and attachEvent methods (only … Read more