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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:48:05+00:00 2026-06-06T01:48:05+00:00

jsfiddle with example Click a county name to see it’s crest appear. I am

  • 0

jsfiddle with example

Click a county name to see it’s crest appear.

I am appending divs as they are needed and the background for each div is from a css sprite which works perfectly. What I would like is to vertical center each added div so they line up more neatly.

I can add position: relative; top: XXpx; and amend the top manually for each each crest e.g..Corksmall { background-position: -25px -27px; height: 27px; width: 25px; position: relative; top: 5px;} but that seems like the brute force method.

Is there a more coder pleasing way of doing this? tia

  • 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-06T01:48:07+00:00Added an answer on June 6, 2026 at 1:48 am

    There’s a simple trick to achieve this behavior.

    #selectedCounties .sprite-smallcrests {
        /* float: left; */ /* removed. no need for, because we apply display: inline-block */
        display: inline-block;
        vertical-align: middle;
    }
    

    Live demo: http://jsfiddle.net/CGcdc/4/

    You may have noticed, that the pictures/divs jump, depending on the height of each picture.
    Prepending an empty element with a height of the tallest picture possible, will prevent the jumping:
    Live demo: http://jsfiddle.net/CGcdc/9/

    If you want to get this crossbrowser compatible, replace the wrapper divs with spans or other elements which are inline-elements by default:

    $('#Clare, #Cork, #Limerick').click(function(){
        $('<span/>', {
            title: 'Co. '+this.id,
            'class': this.id+'small sprite-smallcrests'
        }).appendTo('#selectedCounties');
    });
    

    Hope this will fix your problem 🙂

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

Sidebar

Related Questions

I'm working on a jquery carousel. You can see the example here: http://jsfiddle.net/6fwbS/2/ Click
My code: JSFiddle example as you can see when you click on a parent
Take the example I have setup at http://jsfiddle.net/vEF6y/ Click on the 'add item' button
Here an example http://jsfiddle.net/6GdW6/ $(.thumbnail).live(click, function() { $(.fullimage).hide(); var i = $(<img />).attr(src, this.href).load(function()
I have the following example http://jsfiddle.net/zidski/Mz9QU/1/ If you click on Link2 and then Link1
This is example http://jsfiddle.net/4BjVv/6/ $(function(){ $('ul#crumbs li a').bind('click',crumbClick) }); function crumbClick(){ $('ul#crumbs .selected').removeClass('selected'); $(this).parents('li').addClass('selected');
Here's an contrived example of what's going on: http://jsfiddle.net/adamjford/YNGcm/20/ HTML: <a href=#>Click me!</a> <div></div>
(see jsfiddle example) When the .link_to_rule_them_all is clicked i would like to copy all
Here's the example: http://jsfiddle.net/sammy/RubNy/ Scroll down in the div container. Then click anywhere in
Here's a JSFiddle example so you see what I mean: http://jsfiddle.net/stapiagutierrez/yVzR5/ The event is

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.