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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:04:51+00:00 2026-05-16T15:04:51+00:00

Currently, on my site, I use a background-image with an exact height so that

  • 0

Currently, on my site, I use a background-image with an exact height so that the text (which is also an exact height) fits in on each “line” in the background-image – unfortunately it doesn’t work too good. Whenever Japanese characters are in the list it will “bump” the line, so the background-image loops onto a new “line” and shows about 3px of the other color in the image. I wonder if there is an easier and more “proper” way to do this?

Here’s the current CSS:

div.list{
background-image:url('static/div.png');
margin:25px -25px 5px -25px; /* Just for some space around the list and some removement of the content-padding I have on the site */
}

div.listCaption{
color:#F57F37;
background-color:#D9D9D9; /* So that the listcaption doesn't look like a list-item */
margin-left:-25px; /* This just removes some of the content-padding I have on the site */
padding-left:25px; /* Makes the background for the caption gray */
padding-top:16px; /* Since I have a PHP loop within the list div, I have to make some space between the two lists I have to make it look better */
}
  • 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-16T15:04:52+00:00Added an answer on May 16, 2026 at 3:04 pm

    One simple option is to turn off the vertical repeat on your background image, and set the background color of the list item to be the same as the bottom color on your image. Then you could set up your CSS to look like this:

    div.list {
        background: url("static/div.png") repeat-x left top #fff; /* example color */
        margin:25px -25px 5px -25px;
    }
    

    You could also make your background image taller, so you could extend your gradient to avoid a large solid band at the bottom of the list items when their height is forced to expand.


    EDIT: The PNG in your comment clears things up a bit.

    I’m not entirely sure how you have your HTML set up, but you could simplify the whole thing by using an ordered list and pure CSS.

    <h3>Latest Submissions</h3> <!-- or whatever your title element is -->
    <ul>
        <li>Lorem Ipsum</li>
        <li class="stripe">Lorem Ipsum</li>
        <li>Lorem Ipsum</li>
        <li class="stripe">Lorem Ipsum</li>
    </ul>
    

    Then you could use styles along these lines:

    li {
        display: block;
        background: #999;
        padding: 3px;
    }
    
    .stripe {
        background: #ddd;
    }
    

    Add the strip class to every other list item using your PHP script. What this does makes each list item a block element, and applies a different background if it’s one of the stripe rows. Any extra content in a list item will simply cause it to expand vertically, pushing the next one down, but the background colors will stay with the correct elements.


    EDIT 2: Outputting the list in PHP

    Let’s assume that you have an array of values that you’re iterating through, called $myarray. We can loop through this array and apply the stripe class to even list items like this:

    for($i = 0; $i < len($myarray); i++) {
        $output = "<li";
    
        if($i % 2 == 0) {
            $output .= ' class="stripe"'
        }
    
        $output .= ">" . $myarray[$i] . "</li>";
    }
    

    Make sure that this output is contained within the ul, so you’ll want to do something like this:

    <ul>
        <?php //Put your loop here ?>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am launching an ad on my site that is a huge background image
I currently have a DIV with a background image set as follows: background: url(../images/site/common/body-bannar-bkground.png)
Some background. Currently have an asp.net web site which is contained on 2 web
I currently use SQL Server to store products in a large catalog web site.
I work with a team that has a sharepoint site currently runnning and its
I currently have a site which uses a MySQL 4.x schema, the site uses
I am currently developing a site for a client which uses the JQuery cycle
Background : I am developing a mobile site with lost of images, that take
So I'd like to use some icon images for my site navigation. Currently I'm
Some background: I have an database that I want to use linq-to-sql to update

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.