CSSKarma

display your <style>

CSS Bullet Alignment

This is a problem I struggled with for a while. I like using non-traditional bullets, but if they're 1px too large, they won't line up correctly with the list item. So here's my solution: background image on the list item, I really find it hard to believe that it didn't occur to me earlier while I was fighting margin and padding to align the stupid bullet with the text. Anyways, just in case, anyone else had this problem I thought I'd post what I found. I just used some dummy text in the lists.

Unstyled
Styled with "list-style: disc url(img);" [this is the problem]
.disc li{
list-style: disc url('bullet_arrow_large.gif');
padding-top: 3px;     
padding-bottom: 3px; 
}
Styled with "background: url(img) no-repeat left center;" [this is the solution]
.bg-img li{
list-style: none;
line-height: 34px;
background: transparent url('bullet_arrow_large.gif') no-repeat left center;
padding: 0 0 0 25px; 
}

Looks 100% better doesn't it? AND it's perfectly accessible since it's still a 'ul'. You'll probably have to tweak the padding and margin according to the left-right position you want, but this should give you a good starting place.

with ease,
tim

Picasa feed

  • 2008-matadorLocation: Malibu, CADate: Aug 23, 2008Number of Photos in Album: 53View Album
  • 2008-uscDodgersLocation: Los Angeles, CADate: Aug 14, 2008Number of Photos in Album: 46View Album
  • 2008-movingLocation: Santa Monica, CADate: Jul 30, 2008Number of Photos in Album: 43View Album
  • 2008-GoingAwayLast weekend in RaleighLocation: Raleigh, NCDate: Jul 18, 2008Number of Photos in Album: 54View Album