tags:

views:

352

answers:

5

I'm using a background image to add a custom bullet to list items in my content. In the content there are also images floated left. When an image and a list item are next to each other, the bullet appears where it would do if the image wasn't there, but the text wraps around the image.

Here is an example: http://golf2.test.textmatters.com/content/greenkeepers/turfgrass/turfgrass_speci/cool_season_gra

is there a way to make the bullet appear where is should (i.e. next to the text)?

A: 

Try wrapping your list items in a <p> tag, and then give that tag a left margin.

AlbertoPL
I'm afraid I don't have any control over the html because it is spat out of a back end system. Also I want the text to 'wrap' around it
chrism
A: 

Why do you have div.fig width set to 0 in the html?

<div class="fig" style="width: 0px;"><img src="/images/43_Fescue.jpg" float="0"/></div>

Remove that and the list will float around the image.

Emily
When doing this in Chrome, it placed the bullets to the left of the image, which more-closely matches the scenario of the posted question.
Jacob
hmmm, that shows that you should just develop in a single browser. The style tag is added by javascript, so if you turn off javascript it won't add it, but it doesn't seem to make any difference in FF anyway
chrism
A: 

In Firebug / Firefox (you'll have to check other browsers) I solved your problem adding a:

li {
    overflow:hidden;
}

Don't know why exactly, but that magical line solves lots of problems around floated stuff :-)

Edit: Solution if you can change the html slightly

If you have any control over the html, you could perhaps use paragraph tags instead of list items:

p.list_item {
    background: transparent url(/++resource++stylesheets/images/bullet.gif) no-repeat scroll left 0.45em;
    padding-left: 11px;
}

However, that would kind of change the semantic meaning of the list items...

jeroen
Closer (in FF and Safari at least), but any li's affected by the floating image don't quite wrap properly after the image (i.e. they stay indented)
chrism
Yes, it basically converts it in a block so the result with long bullit points is not that attractive. Don´t have any other solutions though...
jeroen
A: 

Well, it's not the best fix from a stylistic point of view, but floating the images right avoids this problem. Thanks for everyones suggestions

chrism
A: 
cornelius soyo