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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:39:44+00:00 2026-06-18T08:39:44+00:00

Come a bit unstuck here. I’ve got a div thats approx. 2000px wide by

  • 0

Come a bit unstuck here.

I’ve got a div thats approx. 2000px wide by 800px tall.

Inside that div I have another div, with a background image.

I want the internal div, to take 80% height of the parent container, and for the width to keep proportion with the height, so the background image doesn’t distort, if this makes sense?

Im using CSS3 to scale the background image 100% both x and y.

.internal-box {
    background:url(images/elevator.png) repeat scroll 0 0 transparent;
    background-size:100% 100%;
    height: 80%;
    width: auto;
}

http://jsfiddle.net/JbmE6/

  • 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-18T08:39:45+00:00Added an answer on June 18, 2026 at 8:39 am

    Try this:

    background-size: contain;
    background-repeat: no-repeat;   
    

    However note that this might not be fully supported in all browsers such as IE8.

    Also note that this doesn’t make the <div> itself any smaller, it only makes the background image appear in only the relevant portion. If you put a border on .small you will see in fact it is 100% width of its container.

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

Sidebar

Related Questions

So I've come across a bit of a snag in some code that I'm
I've been looking at Sharepoint script files and I've come across this bit that
I have just come a little bit unstuck, I have a list which I
Come to a bit of a mind block here: I need to turn the
I've come across a bit of code that contains a couple code blocks, delineated
I have done a bit of searching here but cannot come up with an
I know that my scenario is a little bit twisted. I have come across
I've come a bit stuck this afternoon with a bug in my web application
I've come across a bit of a weird issue with activities using the Holo
I'm a bit of a NuGet newbie and have come from the Maven world.

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.