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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:20:15+00:00 2026-06-08T14:20:15+00:00

In my page i have many table cells. Inside each cell i have one

  • 0

In my page i have many table cells.
Inside each cell i have one box (i’m using a spoiler code to show or hide contents inside).
The box is described by a CSS.
The boxes are identical in looks, but I want to customize the properties of each as changing the color or background image
I paste CSS several times equivalent to the number of boxes.
I paste css style before each boxes code.
I try to change the background image of each box (default the color is white) but when i try to change one of these backgrounds, i obtain the same background of ALL boxes.
But it isn’t what I want.

I have severals pictures in folder but it seems like I can not have different background pictures for different boxes..

This is the css style I use.:

<style type='text/css'>
            div.myautoscroll {
            height: 80ex;
            width: auto;
            background: white;
            background-image: url(cieloprato.jpg);
            overflow: hidden;
            border: 1px solid #444;
            margin: 1em;
        }
        div.myautoscroll:hover {
            overflow: auto;
        }
        div.myautoscroll p {
            padding-right: 16px;
        }
        div.myautoscroll:hover p {
            padding-right: 0px;
        }


  </style>

The background image for 1st box is cieloprato.jpg. But i want insert different image for box2 like bastman.png, for box3 spiderman.gif.
How Can I change background image or CSS style for every box?
Forgive my ignorance

  • 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-08T14:20:18+00:00Added an answer on June 8, 2026 at 2:20 pm

    I think there are 3 ways:

    Firstly. You may use nth-* css properties, but it does not work in old browsers.

    .myautoscroll:nth-of-type(2) { 
      background: #3e3;
    }
    

    This code change background color in 3 div with this class.

    Secondly. You may add to each div element unique identifier or class, and get it by according selector in css.

    <div class="myautoscroll" id="mas1">...</div>
    <div class="myautoscroll" id="mas2">...</div>
    
    #mas1 {
      ...
    }
    
    #mas2 {
      ...
    }
    

    Thirdly. You may add to each div element style attribute where you point which background you want.

    <div class="myautoscroll" style="background: #0f3">...</div>
    <div class="myautoscroll" style="background: #1f3">...</div>
    

    Fourthly. You may do this by loop in JavaScript (it is just example):

    var elements = document.getElementByClassName('myautoscroll');
    
    for (var i in elements) {
      var el = elements[i];
      el.style.background = '#' + (i % 10) + 'f3';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose on my HTML page I have many href s to a link. Using
I have a page with many checkboxes, each of which are tied to a
I have a table with two UITableViewCell (and one label on each). The idea
I have an asp.net page which needs to return an object with a one-to-many
I'm using JSF/ICEFaces. I have a table that have many rows with values and
I have a table style page with rows. Each row has a checkbox. I
I have a table with many columns. The table is wider than the page,
I have an asp 4.0 page using a formview and C# code as needed.
I have many photos on the page and I'd like to add like buttons
I have many links in my page. For example <a href=/promotions/download/schools/australia.aspx>Australia</a> Now I want

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.