setting overflow hides li bullets (overflow proper

2019-04-16 09:24发布

问题:

setting overflow and text-overflow property makes the li hide bullets. I've tried putting the bullets "inside" but it still didn't show bullets. Plus I'd prefer to put it "outside"

ul.hbox_poplist {
    list-style: circle url('/img/bpt_clear.png');
}

ul.hbox_poplist li {
    margin: 0 0 8px;
    max-height:32px;
    text-overflow: ellipsis;
    overflow-y: hidden;
}

does anyone know any solution to this?

回答1:

Using a CSS background is much more dependable across browsers than using list-style-image for custom bullets. Controlling the position of a list-image is quite difficult on its own.

Something like:

.bullets {
  background-image:url(/img/bpt_clear.png); 
  background-repeat:no-repeat; 
  padding-left:30px; 
  margin-left:-30px;
}

See: http://preview.moveable.com/JM/ilovelists/



回答2:

I remember this problem long before. Yes, its better to follow to what @Diodeus suggests, but adding padding-left to the ul, miraculously solved my problem a couple of times.



回答3:

Get rid of overflow-y: hidden; and set a padding-left for ul. You need this if the list ist displayed "outside". Try the following:

ul.hbox_poplist {
    list-style: circle url('/img/bpt_clear.png');
    padding-left: 20px;
}

ul.hbox_poplist li {
    margin: 0 0 8px;
    max-height:32px;
    text-overflow: ellipsis;
}
​