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

  • Home
  • SEARCH
  • 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 1017687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:44:34+00:00 2026-05-16T10:44:34+00:00

I have a div which size may differ time to time. At I set

  • 0

I have a div which size may differ time to time.

At I set a background image to tat div which image size is fixed.
But I need to fit the background image to div at any size.

How could be possible thro’ CSS.

Thanks in advance!!!

  • 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-05-16T10:44:34+00:00Added an answer on May 16, 2026 at 10:44 am

    The only way to change a size of an image with CSS is when it’s an <img> element.
    I mean that you can do something like that:

    img#myBG { width:200px; height:100px; }
    

    If you need it to be a background, you should use ‘z-index’ and put your img under a the element that holds the content.

    Something like this:

    <div id="holder">
      <img id="myBG" src="...." />
      <div>my content here</div>
    </div>
    
    <style>
    #holder { position:relative; width:200px; height:100px; }
    #holder div { position:absolute; top:0; left:0; z-index:2; }
    img#myBG { width:200px; height:100px;  { position:absolute; top:0; left:0; z-index:1;  }
    </style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div.one which has a fixed size and a background color. Within
I have a fixed size div which I need to fill with text. I
I have a very simple HTML/JS code, which expands the size of a div
I have DIV element which only has a few lines in and a background
I'm trying to create a div which will have fixed width and flexible height
I have four div s which are animated using size, height and positions; that
I have one container div which contain 2 dynamic height (height haven't been set)
Let's say I have a div to which I set height: 500px; in CSS,
I have a div which could be dragged around and scaled. It may or
I have a div which when hovered scales up in size - This all

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.