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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:04:47+00:00 2026-05-10T21:04:47+00:00

I have a couple of Divs which I style using a class and an

  • 0

I have a couple of Divs which I style using a class and an ID, he div’s themselves are emtpy since they are only placeholders for their background. Example Div:

<div id='ranImg1' class='ranImg'></div> 

Then I style them using this css:

.ranImg {   position:fixed;   z-index:0;   width:250px;   height:250px;   display:block; } #ranImg1 {   left:10px;   top:200px;   background-attachment:fixed;   background-image:url(http://localhost/MyAlbum//images/background/ranPaperclips.png);   background-repeat:no-repeat; } 

As long as the Div is in the left top of the document the Image shows correctly but when the Div is placed somewhere else on the page the image stays (invisible) in the top left corner of the page showing only the part which overlaps with the div (in the example this would be the bottom part of the image).

EDIT I’m trying to position these Divs without effecting my other layout, they are behind the other layout. This works except for the fact that the background image doesn’t follow the divs position.
So basically my question is, why isn’t the background for the ranImg1 div positioning with the div but stays in the left top corner, and how to fix this?

  • 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. 2026-05-10T21:04:48+00:00Added an answer on May 10, 2026 at 9:04 pm

    your background-attachment:fixed will attach the background image relative to the browser window. if you want it to ‘follow’ the div position, just remove the line:

    #ranImg1{   left:10px;   top:200px;   background-image:url(http://localhost/MyAlbum//images/background/ranPaperclips.png);   background-repeat:no-repeat; } 

    you could also set the background-position attribute to set the background relative to the containing div:

    background-position: 0px 0px; 

    i’m not sure if that would help any beyond just removing background-attachment though (not enough coffee yet!)

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

Sidebar

Related Questions

I have a couple of divs setup. <div class=terrain water></div> <div class=terrain water></div> <div
I have div container and inside couple divs with class demo like <div id='container'
I have one parent div with style position relative and couple divs inside that
I have a form which has elements in a couple of divs. Based on
I have a page with a couple of divs, sort of like this: <div
I have a couple divs like so: <div>1</div> <div>2</div all the way through to
I have div container and inside couple div with class demo and gravity like
I have couple of divs with class priceText and I am trying to accomplish
I have a couple of nested divs and have set a CSS class for
I have a couple of divs, each with a background image. I'm using responsive

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.