Skip to content

Invert your Mind

  • Home
  • Contact

list item

centeringdivhtmlimageslilist itemtext

Centering images and text inside an li or div

Found a good fix for this one as well. This will work on LIs or DIVs. Here’s how to do this in IE and FireFox:

li {
  display: inline;
  text-align: center;
}

li img {
  display: block;
  margin: auto;
}

The HTML looks like this:

<ul>
  <li><img src="..."/>Some text</li>
  <li><img src="..."/>Some text</li>
</ul>
4 Comments November 18, 2008 bpontarelli
CSSielilist itemspacingunordered list

Getting rid of spaces between LIs in IE

Took a bit of research, but the only way I could get rid of all the space between LIs in IE was to make the LI inline and the anchor tag within the LI a block like this:

.some-class li {
  display: inline;
}

.some-class li a {
  display: block;
}
Comment November 18, 2008 bpontarelli
Blog at WordPress.com.
  • Follow Following
    • Invert your Mind
    • Already have a WordPress.com account? Log in now.
    • Invert your Mind
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar