使用表格的 CSS Sprite 按钮...无法摆脱 IE 中表格后的换行符(怪异模式)

发布于 2024-12-07 19:53:10 字数 492 浏览 6 评论 0原文

我正在使用以下图像创建一个 css 按钮...

css bg

这是表格的背景.. 文本因为图像位于 td 块内。

您可以在这里看到它的实际效果,请查看源代码以了解它是如何工作的,CSS 是内联的。

css 按钮链接

一切似乎都工作得很好......但在 IE 中查看它并火狐。您会注意到,出于某种原因,IE 中存在换行符,而 Firefox 中则没有。我希望它没有换行符,firefox 风格。

我知道很多人会立即说“只需添加一个 DOCTYPE 标签,一切都会好起来的!” 不幸的是,我的用例是它必须在 IE 怪癖模式下工作。

那么..这是一个限制..有什么想法吗?

I am creating a css button using the following image...

css bg

This is the background of a table.. the text for the image goes inside td blocks.

You can see it in action here, please view source to see how it all works, css is in-lined.

css button link

Everything appears to be working great... but view it in IE and Firefox. You'll notice that for some reason there are line breaks in IE and not in Firefox. I want it to not have the line breaks, firefox style.

I know a lot of people will immediately say "Just add a DOCTYPE tag and all will be well!"
Unfortunately my use case is such that it has to work in I.E. quirks mode.

So..with that being a restriction.. any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假面具 2024-12-14 19:53:10

您是否尝试将“float:left;”添加到CSS类“.spriteTableButton”?这样可以立即解决断行问题。

Did you try to add "float:left;" to css class ".spriteTableButton" ? This can solve the problem of linebreak in no time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文