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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:52:06+00:00 2026-06-11T12:52:06+00:00

Possible Duplicate: Set size on background image with CSS? I need to find a

  • 0

Possible Duplicate:
Set size on background image with CSS?

I need to find a solution on how to get the same effect of the background image i have achieved here but using the image tag. In other words i probably need to use Javascript to do that, but i am not finding any solution suitable.

Here the Html of my body in the example page.

     <div id="contacto">

       <div class="home">

       </div>     

  </div>

The CSS is the following:

  #contacto {
  background-image: url("../img/barcelona-buildings.jpg");
  background-attachment: fixed;
  background-position: center 965px;
  height: 350px;
  width: 100%;
  margin-top: 75px;
  box-shadow: 2px 1px 6px 0 #888888 inset;
  -moz-box-shadow: 2px 1px 6px 0 #888888 inset;
  -webkit-box-shadow:  2px 1px 6px 0 #888888 inset;
}


.home {
    overflow: hidden;
    z-index: 1;
}

Right now but i want to delete background-image: url("../img/barcelona-buildings.jpg"); in the CSS and using <img src="../img/barcelona-buildings.jpg" alt=""> inside the div class="home" with Javascript automatically resize the img regarding width of the display

Is it possible? How can i achieve it?

  • 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-11T12:52:07+00:00Added an answer on June 11, 2026 at 12:52 pm

    For IMG write like this:

    .home img{
      position:fixed;
      width:100%;
      height:auto;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Android Button: set onClick background image change with XML? I need that
Possible Duplicate: How to set background image of a view? How to set UIView
Possible Duplicate: How to set cellpadding & cellspacing in CSS? i have a little
Possible Duplicate: How to get/set logical directory path in python I have a Python
Possible Duplicate: Set/Get values for RadioGroupFieldEditor in SWT I have a RadioGroupFieldEditor field and
Possible Duplicate: SmartGWT Dialog title not set correctly I have a problem, is that
Possible Duplicate: Android - how to set the wallpaper image I want to change
Possible Duplicate: How do I programmatically set the background color gradient on a Custom
Possible Duplicate: How to set android lock screen image I was able to set
Possible Duplicate: Dynamic array keys I have an array $Values which is set up

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.