开发者

CSS Sprite Button With float:left... Not centering inside a table in Firefox

开发者 https://www.devze.com 2023-03-31 09:23 出处:网络
Amazing...something I have 开发者_开发百科gotten to work in IE and NOT Firefox!Quite the turn of events, eh?

Amazing...something I have 开发者_开发百科gotten to work in IE and NOT Firefox! Quite the turn of events, eh?

Anyway, here's the problem. Check out the following page in both IE and Firefox:

http://www.lolstrategies.com/test/button_sample.html

I'm using this file to put together the button.

CSS Sprite Button With float:left... Not centering inside a table in Firefox

(http://www.lolstrategies.com/test/composite__V153767378_.png)

Obviously this button is centered in only IE.. what gives?! I'm using a span for the background that is under the text and another for the tip and then floating them together with float: left as you can see by viewing the source.

So, what can I do to get this span centered in Firefox?

Thanks in advance.. please let me know if there you have any questions about this that I can help answer!


Your span.buttonLarge contains two uncleared floated block-level elements, hence no centering. In order to fix this, you could apply display: inline-block and margin: 0 auto to it.

P.S. You don't have a DOCTYPE specified, that's why your current solution works in IE - it is rendering it in Quirks mode.


Remove float: left; from .primaryLargeButtonSpan and .primaryLargeButtonEnd

after that change display: block; to display: inline; from .spriteButton span.button_label OR change it to display: inline-block; and then, set the background property to url("./composite__V153767378_.png") no-repeat scroll left -76px transparent;

You might notice some "defect" in the ending image though...

0

精彩评论

暂无评论...
验证码 换一张
取 消