谷歌的无图像按钮
最近有一些关于 Google 新的无图像按钮的文章:
- http: //stopdesign.com/archive/2009/02/04/recreating-the-button.html
- http://stopdesign.com/eg/buttons/3.0/code.html
- http://stopdesign.com/eg/buttons/3.1/code.html
- http://gmailblog.blogspot.com/2009/02/new-ways-to-label-with-move-to-and- auto.html
我真的很喜欢这些新按钮在 Gmail 中的工作方式。 如何在我的网站上使用这些或类似的按钮? 是否有任何具有类似外观和功能的开源项目? 感觉?
如果我想使用 JQuery/XHTML/CSS 滚动我自己的按钮包,我可以使用哪些元素? 我最初的想法是:
-
标准
使用 css 来改善外观(设计文章主要讨论了涉及到的 css/imges。)
-
Jquery javascript 来调出一个基于 root 的自定义对话框到“onclick”事件上的按钮,其中包含
标签和用于过滤的搜索栏? 该弹出窗口的表格布局是否合理?
我不擅长对网络上的东西进行逆向工程,我可以使用哪些工具来帮助对这些按钮进行逆向工程? 使用 Firefox 的 Web 开发人员工具栏,我无法真正看到按钮弹出对话框中使用的 css 或 javascript(即使已缩小)。 我可以使用什么浏览器工具或其他方法来查看它们并获得一些想法?
我不想窃取任何 Google 的 IP,只是了解如何创建类似的按钮功能。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
带有关闭库链接的帖子不适用。 作为闭包库的一部分发布的内容使用带有渐变的按钮。
列出的其他解决方案没有用。 您无法从那里开始让这些按钮在 Gmail 允许的每个浏览器上正常工作。 鲍曼在他的网站上显示的不是工作代码。
The post with a link to the closure library does not apply. What was released as part of the closure library uses buttons with gradients.
The other solutions listed are useless. You cannot go from there and get these buttons working on every browser Gmail has them working. What Bowman shows on his site is not working code.
Web 开发者工具栏 在 css 菜单下有一个视图样式信息,会告诉你什么CSS应用到了一个项目。 该菜单中还有“编辑 CSS”功能,可让您动态更改 CSS 以查看它如何影响页面。
The Web Developer Toolbar has a view style information under the css menu that will tell you what css is applied to an item. There is also the Edit CSS feature in that menu that will let you change the CSS on the fly to see how it affects the page.
这里的大部分工作可能不是设计 - 这些帖子已经是关于渐变效果的出色指南。
问题是让这个在所有浏览器中工作,或者更具体地说是 IE6 和 IE7 等奇怪的垃圾堆。
我认为您走在正确的轨道上,使用一个用 jQuery 重写的标准按钮 - 这样屏幕阅读器仍然可以访问您的内容,并且可以在真正旧的浏览器中很好地降级。
对于 HTML,我认为你最好的选择是使用每个浏览器访问 Gmail 并查看生成的 HTML - 我希望 IE6、IE7(也取决于它们是否需要怪异模式)和其他所有浏览器生成的 HTML 完全不同。
The majority of the work here probably won't be the design - those posts are already an excellent How-To on the gradient effects.
The problem is getting this working in all browsers, or more specifically the quirky piles of rubbish that are IE6 and IE7.
I think you're on the right track with a standard button that gets re-written with jQuery - that way you'll still be accessible for screen readers and can degrade nicely in really old browsers.
For the HTML I think your best bet is to visit Gmail with each browser and see what HTML is produced - I'd expect it to be completely different for IE6, IE7, (also depending on whether they need quirks-mode) and everything else.
这些是作为闭包库的一部分发布的:请参阅按钮演示
These were released as part of the closure library: see the button demo
2011 年更新此帖子:
Google 于 2011 年 7 月在其服务中推出了新设计。新的 Google 按钮已在此处重新创建:http://pixify.com/blog/use-google-plus-to-improve-your-ui/
新按钮如下所示:
Updating this post for 2011:
Google launched a new design across its services in July 2011. The new Google buttons have been recreated here: http://pixify.com/blog/use-google-plus-to-improve-your-ui/
The new buttons look like this:
您可以尝试使用 Firefox 的 Firebug 插件来查看按钮上的 CSS。
You could try using the Firebug plugin for Firefox to view the CSS on the button.
您将遇到的最大问题是使其能够跨浏览器工作。
我认为你应该认真考虑你是否真的需要它......谷歌通过制作这样的东西获得了很大的回报,因为他们需要大量的按钮和语言; 我怀疑大多数网站和应用程序都可以使用图像。
不过,开源组件是一个好主意:广泛传播财富和努力。
The biggest problem you are going to have will be making it work across browsers.
I think you should strongly consider whether you really need it ... Google gets a lot of bang for the buck by making something like this because of the vast number of buttons and languages that they need; I suspect that most sites and applications would be just as well-off using an image.
An open-source component is a good idea, though: spread the wealth and effort widely.
无论您决定如何执行,请确保首先使用默认值渲染页面:
... 然后使用 jQuery 将输入元素与具有 onClick 事件的自定义按钮交换。 这将确保未启用 JavaScript 的用户仍然能够使用您的网站。
可用性应该是第一位的!
However you decide to do it, make sure you first render the page with the default:
... And then use jQuery to swap the input element with your custom button that has an onClick event. This will ensure that people without JavaScript enabled will still be able to use your site.
Usability should come first!
你可以使用我开发的这个 jquery 插件。 这些按钮几乎可以在任何地方使用,而且由于它是一个插件,因此很容易设置和配置。
http://swizec.com/code/styledButton/
You could use this jquery plugin I've developed. The buttons work pratically anywhere and since it's a plugin they're easy to set up and configure.
http://swizec.com/code/styledButton/
- 编辑 - 我没有看到原始帖子中的链接。 对不起! 将尝试重写以反映实际问题
StopDesign 有一篇关于此的精彩帖子 这里。 [edit 20091107] 这些是作为闭包库的一部分发布的:请参阅按钮演示。
基本上是自定义的他显示的按钮是使用简单的CSS创建的。
他最初使用了 9 个表格来达到效果:
但后来他用了一个简单的上下边框各留1px左右边距,可以达到同样的效果。
渐变是通过使用三层来伪造的:
所有代码都可以找到在自定义按钮 3.1 页面。 (虽然没有图像的渐变仅适用于 Firefox 和 Safari)
分步说明
1 - 插入以下 CSS:
2 - 使用以下方法之一来调用它(更多内容可以在上面的链接中找到)
或
-- EDIT -- I didn't see the link in the original post. Sorry! Will try and re-write to reflect actual question
StopDesign has an excellent post on this here. [edit 20091107] These were released as part of the closure library: see the button demo.
Basically the custom buttons he shows are created using a simple bit of CSS.
He originally used 9 tables to get the effect:
But later he used a simple 1px left and right margin on the top and bottom borders to achieve the same effect.
The gradient is faked by using three layers:
All of the code can be found at the Custom Buttons 3.1 page. (although the gradient without the image is only working in Firefox and Safari)
Step by Step Instructions
1 - Insert the following CSS:
2 - Use one of the following ways to call it (more can be found in the links above)
or
据 Firebug 称,这是他们的“存档”按钮。
CSS 超出了我的组织/粘贴范围。 也许只有我这么认为,但是当标记/CSS变得如此繁重时,我想我宁愿使用图像(或几个图像作为背景。更好的是,Sprites)。 此外,这个按钮的图像不会超过一个 K。
尽管我很喜欢 Google,但这似乎有点过分了。
更新:
谷歌是一个独特的案例。 如果您是一个大型网站并且希望将您的内容国际化,那么这种无图像技术实际上非常酷。 它允许您将几乎任何书面语言应用到您的 UI,而无需生成新图像,也无需担心破坏按钮。
请参阅问题:使用无图像按钮有哪些优点?< /a>
This is their "Archive" Button, according to Firebug.
The CSS is more than I care to organize/paste for this. Perhaps it's just me, but when the markup/css become this heavy, I think I would much rather USE AN IMAGE (or a couple images as backgrounds. Better yet, Sprites). Besides, an image for this button would be less than a single K.
As much as I love Google, this seems a bit overkill.
Update:
Google is a unique case. If you're a massive site and you wish to internationalize your content, then this image-less technique is actually really cool. It allows you to apply just about any written language to your UI, without needing to generate new images, or fear of breaking your buttons.
See Question: What are the advantages of using an imageless button?