Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List-Style-Image w/ list-style-position alignment issue 1

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
I have an alignment issue for the custom image of an unordered-list in Internet Explorer

In FireFox, Chrome, and Safari (Win) it works fine but in IE7 it leaves no spacing between it and the line item. (surprise, surprise IE breaks)

The document validates successfully as XHTML 1.0 Strict and CSS level 2.

You can see an example at
That is just a small part of the page - though it does show what is wrong.

Any idea on how to fix the bullet spacing issue?

Thanks.
 
Define both margin-left and padding-left as the browsers use different defaults for lists.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Off topic - kinda...

Also be aware that if you float the LI elements, they will lose the custom images (in IE6 and IE7 only). This is actually a correct interpretation of the specs... but a real pain (solved by adding a SPAN inside the LI to contain the image as a background item).

I just spent quite some time trying to fix this problem only to find it's not fixable *lol*

Cheers,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
@traingamer - Define them where? I have "margin:0;padding:0;" on the UL (I also have it in a body definition within the external css file).

@BabyJeffy - sounds like that effects just LI elements that are floated - not the container a UL happens to be in (right?).
 
Correct [smile]

I was attempting to use floated LIs to create a "breadcrumb" trail... and spent ages trying all manner of "tricks" and hacks to no avail.

Cheers,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Your list-style-position: inside; is forcing the image against the list item in IE.

Is this IE being wrong or just a different interpretation of the spec - couldn't say.

I've had more success with a background image on the li. Actual example:
Code:
ul li {
	margin: 3px -20px 3px 20px;
	padding: 0 0 0 0;
	list-style: none;
	background: url(newbullet.gif) no-repeat 0 3px;
}
You may or may not need the negative right margin for your purposes.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Finally got around to trying the image as a background and it looks fine now.

As far as IE being wrong - I would have to say yes (though I'm sure there will be those that disagree), as every other browser (that I've tested) does it the other way - plus it isn't acting as expected.

Thanks traingamer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top