Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8828859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:42:09+00:00 2026-06-14T07:42:09+00:00

I have a webpage and I am trying to place a canvas inside a

  • 0

I have a webpage and I am trying to place a canvas inside a set of div tags. However I need the canvas to be on top / a layer above the images within the div. No matter what I try or where I place the canvas html line, I can not get it to work canvas to show above the image in div1.

First I define the styles of the div classes.

#div1 {width:100%; background:transparent url(img/header-bg.png) no-repeat; height:400px; position:relative;}
#div2 {width:100%; background:transparent url(img/nav-bg.png) repeat-x;}
#div3 {
height:450px;
width:100%;
position:absolute; 
background:transparent url(animation/SampleAnim_0010000.png) no-repeat 80% 0; 
}

#div4 {
height:390px; 
width:100%; 
border-bottom:10px solid rgba(255, 255, 255, 0.5);
}

Then my html

<div id="div1">
    <div id="div2">
        <div id="div3">
            <div id="div4">             

            </div><!--div4-->

        </div><!--div3-->
    </div><!--div2-->
</div><!--div1-->

No matter where I insert within the divs

<canvas id="canvas" width="500" height="220"></canvas>

the image set in id=div1 (img/header-bg.png) overlaps the canvas. div2, div3 and div4 are correctly overlapping div1. How can I do this with the canvas?

My canvas script looks something of the lines of

<script>

var canvas = document.getElementById('canvas');
if(canvas.getContext){
    // canvas animation code here:
    var ctx = canvas.getContext('2d');

    var lhs = new Image();

    lhs.src = "animation/SampleAnim_0010000.png";

        ctx.drawImage(lhs, 0, 0);

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:42:10+00:00Added an answer on June 14, 2026 at 7:42 am

    Appears to be working for me: http://jsfiddle.net/RnEc6/1/

    <div id="div1">
        <div id="div2">
            <div id="div3">
                <div id="div4">             
                    <canvas id="canvas" width="500" height="220"></canvas>
                </div><!--div4-->
            </div><!--div3-->
        </div><!--div2-->
    </div><!--div1-->​
    

    I’m thinking you have a typo somewhere or styling applying a z-index to your div or canvas elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flash video player in a div inside a webpage, I'm trying
I'm trying to select an element from my webpage... I have inserted a control
I'm trying to pull some data from a webpage. I have it partially working,
I have a webpage including the following div: <div class='book_box'> <table border=0 cellspacing=0> <tr>
I have a main container div in the center of my webpage. This is
I have a webpage where I'm trying to figure out how to click on
I have a problem when trying to parse a webpage using jSoup. If I
I have a webpage I was trying to develop, but I can't figure out
OK so im trying to have a webpage that rotates every 30 seconds now
I have a webpage form with a checkbox on it. I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.