- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML5 Canvas & z-index issue in Google Chrome
When we apply z index to a canvas whose position is fixed, it stop causes chrome to render all other elements which have position:fixed properly. This only happens if canvas is greater than 256X256 px in size.
Wrap both h1 and canvas with the fixed div and solves the issue −
<div id = 'fixcontainer'> <h1>Test Title</h1> <canvas id = "backgroundCanvas" width = "1000" height = "300"></canvas> </div>
The following is the CSS −
h1{ position: fixed; } body{ height: 1500px; } canvas{ position: fixed; z-index: -10; }
Advertisements