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
There’s a simple trick to achieve this behavior.
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 withspans or other elements which are inline-elements by default:Hope this will fix your problem 🙂