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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:24:51+00:00 2026-05-30T10:24:51+00:00

this is pretty frustrating… basically i’m creating a menubar on a site, and have

  • 0

this is pretty frustrating…

basically i’m creating a menubar on a site, and have used css sprite to have a hover effect where the image changes as you hover over it. this is working fine, but i can’t display multiple images inline because i have to use display:block in the css for the sprite/hover class for it to work.

here is some of the css code i have:

.x a {display:block; width:100px; height:100px; overflow:hidden;}
.x a:hover img {margin-left:-100px;}
/* ie6 needs this fix*/
.x a:hover {zoom:1;}

and then here is the code in the php file (it’s part of a wordpress theme, this bit going in the header.php file):

<div class='x'><a href='#' alt='#'><img src='#' /></a></div>

note: the image used is a horizontal sprite, so two images merged into one (100×100 turned into 200×100).

this alone works fine, but then when i add something to it like:

<div class='x'><a href='#' alt='#'><img src='#' /></a></div> &nbsp; 
<div class='x'><a href='#2' alt='#2'><img src='#2' /></a></div>

it makes it go to a new line. i thought it may be a padding issue where it’s overflowing on the line, but i’ve tried doing just two images (total area taken up maybe 210px) and it’s in a 911px container area and still goes to a new line.

i’ve tried using < span> tags, tables, inline-block, and several other things but still no success. at one point i got it to stay inline but then the image was placed beneath all the others, in the correct horizontal position but wrong vertical position.

the goal is to have about 8 100×100 images all in a row in the menu bar, with one spacing in between each one, in a container with width 911px. they all will be in the ‘x’ class so that the image changes when hovered over.

sorry for writing so much but wanted to get it clear. please help!

  • 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-30T10:24:53+00:00Added an answer on May 30, 2026 at 10:24 am

    The divs are rendering as blocks, which is why the images aren’t sitting beside eachother.

    If I understand what you’re trying to achieve correctly, adding a rule

    .x { display: inline-block }

    will do what you want.

    I made a JSFiddle to try it out: http://jsfiddle.net/XZWzW/

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

Sidebar

Related Questions

I have written something like this pretty easily in C# ( string GetUrl(new {
Seems I've outdone myself. All the while I was creating this pretty little 'latest
This is pretty weird. I have my Profiler open and it obviously shows that
This is pretty interesting, this site runs a speed test and compares all of
So i have this pretty large project and i have to create database schemas
I'm starting with WPF and I have this pretty easy question: I have a
This is a pretty frustrating newb question, but I can't seem to get iteration
This seems pretty trivial, but it is now frustrating me. I am using C#
I have this pretty requirement. I am coming trying to come up with an
This pretty much has me defeated. On XP and earlier versions of Windows you

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.