通过 CSS 向 IE8 中的提交按钮添加色调/颜色,同时保留“玻璃”效果看?

发布于 2024-11-05 03:08:57 字数 298 浏览 1 评论 0原文

我正在编写一个网络应用程序。它只会与 IE8 一起使用,所以我不关心任何其他浏览器的行为。

所以:我知道如何使用 CSS 属性(例如背景颜色、边框等)自定义按钮的样式。然而,当您以这种方式应用样式时,生成的按钮看起来像一个块状表格单元格,与 IE8 默认呈现的漂亮玻璃状按钮完全不同。

有什么方法可以为漂亮的玻璃按钮添加色调吗?即,它看起来就像平常一样,但是用红色轮廓而不是蓝色,并且鼠标悬停时红色突出显示?

或者这是我必须手动处理图像的事情?同样,IE8 特定的方法是完全可以接受的。

谢谢!

-担

I'm writing a web app. It's only ever going to be used with IE8, so I'm not concerned with the behavior of any other browsers here.

So: I know how to custom-style a button using CSS properties e.g. background-color, border, and so on. However, when you apply styles that way, the resulting button looks like a blocky table cell, nothing like the nice, glassy-looking button that IE8 renders by default.

Is there some way to add a tint to the nice glass-looking button? I.e., it looks just like it normally does, but with a red outline instead of blue, and a red highlight on mouse-over?

Or is this something I'm going to have to do by hand with images? Again, IE8-specific methods are perfectly acceptable.

Thanks!

-dan

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

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

发布评论

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

评论(4

じее 2024-11-12 03:08:57

尽管使用 button 标签和标准 css 可以非常接近,但实际上并没有一个过滤器可以让您尽可能接近 IE 中的默认值。不过,它在所有版本的 IE 中看起来并不相同。

这是过滤器参考,但如果您想尝试其他事情。

There isn't really a filter that will get you as close to the default in IE, though you can get pretty close using the button tag and standard css. It will not look the same in all versions of IE though.

Here's the filter reference though if you want to try other things.

別甾虛僞 2024-11-12 03:08:57

无论使用哪种浏览器,通过标记设置按钮样式的最快、最简单、最广泛测试的方法之一是 Jquery UI 按钮 只需向类元素添加一些标签,您就得到了一个基于链接、按钮或输入字段的按钮。对于样式,您可以通过 CSS 或通过做得很好的 ThemeRoller 选项来处理样式,您可以通过简单的 GUI 界面控制从文本大小到背景类型的所有内容 - 并且您可以在后端甚至用户端进行更改眨眼之间,甚至通过下拉。

需要注意的是,由于 IE 不符合标准,因此圆形按钮无法通过正确的样式优雅地变成方形。

我意识到您已经决定可以使用 IE 的专有解决方案,并且就您的情况而言,从长远来看,它可能会很好。但根据我的经验,这是一条非常危险的道路。如果实际的长期比您预期的“长期”长怎么办?您指定的是,对于远远落后于公认标准的浏览器来说,专有浏览器是可以接受的,该浏览器已经落后了一个版本,并且使用不受支持的(按通用标准)解决方案来解决问题。可以想象,该版本将变得越来越难找到,如果微软坚持他们的模式,一旦你安装了 IE9,它就会有效地使你的计算机难以降级。而且,我再怎么强调也不为过,IE 的市场份额正在急剧下降,考虑到基本上 95% 的机器都预装了 IE,这真是太可怕了。只需要一位过于热心且“牢记安全”的 IT 主管,就能让您的编程工作变得毫无意义。抱歉,我的咆哮,但是 IE 专有代码已经让我好几次了……

Regardless of browser, one of the quickest, easiest, most widely tested methods for styling buttons via markup is Jquery UI's button It's a matter of adding a few tags to the class element, and you've got a button based on an link, button, or input field. For styling, you can handle styling via CSS, or via the very well done ThemeRoller option, where you can control everything from text size to background type via a simple gui interface--and you can change on the back end or even the user end on the blink of an eye, even via drop down.

One caveat, since IE is non-standards compliant, rounded buttons fail gracefully to square--with proper styling.

I realize that you have determined that you can use a proprietary solution for IE, and in your case it might be just fine over the long term. But in my experience, that's a really dangerous path to follow. What if the actual long term is longer than your anticipated "long term?" You're specifying that it's acceptable to be proprietary to a browser that's well behind the accepted standards, is already a version behind, and uses unsupported (by universal standards) solutions to solve problems. Conceivably, that version is going to get tougher and tougher to find, and if Microsoft holds true to their patterns, once you install IE9 it will effectively render your computer difficult of downgrading. And, I can't emphasize enough that IE's market share is dropping like a rock, which is scary considering basically 95% of the machines out there have it pre-installed. All it's going to take is one overzealous IT director with "security in mind" to render your programming efforts moot. Sorry for the rant, but IE proprietary code has bit me hard more than a few times...

眉黛浅 2024-11-12 03:08:57

我必须仔细检查,但您应该能够使用背景颜色的组合并使用透明 PNG 或 GIF 作为“背景图像”来添加亮点。

在所有条件相同的情况下,我宁愿接受扁平的方形按钮 - 寻找让它与设计很好地配合的方法 - 但话又说回来,我一直是一个直线、方形边缘的人。 :)

正如其他人提到的,您确实希望(在合理范围内)注意您可能需要处理的事情。很可能在下一次重写之前您将不得不处理 IE9 - 编写在 IE8 和 IE9 中运行良好的代码将是最谨慎的方法。

I'd have to double-check, but you should be able to use a combination of a background color and use a transparent PNG or GIF as the "background image" to add the highlights.

All things being equal, I've rather embraced the flat, square button - finding ways to make it work well with the design - but then again I've always been a straight line, square edge kind of guy. :)

As others have mentioned, you do want to be mindful (within reason) of what you may have to handle. It's quite possible that before the next re-write you're going to have to deal with IE9 - writing code that works well in IE8 and IE9 would be the most prudent approach.

飘逸的'云 2024-11-12 03:08:57

看看 http://www.webdesignerwall.com/demo/css-buttons.html 以及 http://css3pie.com/

结合这些你也可以在 IE 中得到漂亮的按钮。

Have a look at http://www.webdesignerwall.com/demo/css-buttons.html and also http://css3pie.com/.

Combining those you can get nice looking buttons in IE as well..

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