
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to center canvas in HTML5?
To center canvas in HTML 5, include the canvas tag in div tag. Then we can center align the div tag. By doing so, the canvas is also center aligned.
Example
<!DOCTYPE html>. <html> <body> <div style = "text-align:center;"> <canvas style = "background-color:GREEN;">This is my canvas</canvas> </div> </body> </html>
- Related Articles
- How to rotate an image with the canvas HTML5 element from the bottom center angle?
- How to detect point on canvas after canvas rotation in HTML5
- How to center an image in canvas Python Tkinter
- How to draw an oval in HTML5 canvas?
- How to apply antialiasing in HTML5 canvas drawImage()?
- How to save canvas data to file in HTML5?
- How to draw lines using HTML5 Canvas?
- How to use images with HTML5 canvas?
- How to save HTML5 canvas data to file?
- HTML5 Canvas to PNG File
- HTML5 Canvas fit to window
- Translating HTML5 canvas
- HTML5 Canvas distorted
- HTML5 Canvas Transformation
- How to draw large font on HTML5 Canvas?

Advertisements