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 8245083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:04:10+00:00 2026-06-07T22:04:10+00:00

so i have my index.html and a canvas.css body{ } #canvasHIPPO{ display:block; margin:0px auto

  • 0

so i have my index.html and a canvas.css

body{
}
#canvasHIPPO{
 display:block;
 margin:0px auto 0px;
 width:100%;height:100%
 background-image:url('http://www.pcl.co.nz/site/pclimaging/images/Big%20Print%20Carry.jpg')
}

in my index.html:

<div id="container">
<canvas id="canvasHIPPO" width="800" height="600" display="block"></canvas>
</div>

I would like to know how to:
1) center the canvas ontop of the background city image, despite 2) different screen sizes and/or 3) maintain the same aspect ratio.

I was pretty sure the margin:0,auto should have fixed the (1) and centered the canvas ontop of the background image…what am i missing?

Thanks!

  • 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-07T22:04:11+00:00Added an answer on June 7, 2026 at 10:04 pm

    Are you trying to centre the image horizontally or vertically?
    If you are centring it horizontally, in your css it should be:

    #content {
        background-image: url('http://www.pcl.co.nz/site/pclimaging/images/Big%20Print%20Carry.jpg');
    }
    
    #contentHIPPO {
        margin: 0 auto;
        display: block; 
        width: 800px;
        height: 600px;
    }
    

    and in your html:

    <div id="content">
        <div id="contentHIPPO">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div>
    </div>
    

    This will cause the div to be centred horizontally, with the image repeating in the background. If you want the image to be re-sized to the browser window, you would need to use javascript to get the size of the window.

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

Sidebar

Related Questions

here's the code: HTML: <body onload=initializeMap()> <div id=map_canvas style=width:100%; height:100%; z-index:1></div> <canvas id=control style=width:100%;
I have a template in joomla without index.php I only have index.html, css file,
I have an index.html and global.css files. When I open these files at Coda,
I have sample site: /index.html /appcache.manifest /style.css /test.js index.html: <!DOCTYPE HTML> <html manifest=appcache.manifest> <head>
I have a page in HTML(index.html), and a folders named images, css, js that
i am using php 5.2.8 i have index.html, which loads LOAD.PHP from IFRAME. iframe
Basicily i have a index.html shown below.. <html> <head> <title>UI Test: Main Menu</title> <script
I have 3 files: index.html.erb is my homepage inside the index I render a
I have the following file structure: |- index.html vendor |- jquery.min.js (some libraries) js
I have Javascript function defined in the main index.html file. One part of this

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.