css - 行业标准图标尺寸

标签 css icons

我正在尝试向网站添加图标,但如何使文本大小和图标大小正确排列是一个问题。

所以我调查了 Windows Style Guide以及可供下载的图标集,并注意到它们大多遵循 16x16、24x24、32x32、48x48、64x64 等尺寸结构。

首先我想问为什么选择上述尺寸以及为什么它们是8的倍数?例如,为什么没有 15x15、25x25 等。

是否有正确使用图标和图标文本的最佳实践指南?

最佳答案

Back in the early days of Windows, video cards were monochrome or, if you were lucky, 16-color. These were all planar video modes, the mechanics of which were discussed earlier. Now imagine copying a bitmap to the screen where both the bitmap and the screen are planar. If the starting coordinates of the destination was an exact multiple of eight, then the bitmap could be copied via block transfer instructions. On the other hand, if the destination was not a perfect multiple of eight, you had to do a lot of fancy bit shifting to get it onto the screen.

This is the source of the CS_BYTEALIGNCLIENT window class style. With this style set, the window manager will try to position the window so that the x-coordinate of the client rectangle's upper left corner sits at a perfect byte boundary of video memory. If you were running at a 1bpp video mode (monochrome or 16 color), this meant that the x-coordinate was a multiple of eight. By positioning the window this way, a bitmap copied to the upper left corner of the client rectangle would be copied via fast block transfer instructions.

If you look at dialog box dimensions from Windows 95 or earlier, you'll find that they are nearly always a multiple of 32 DLUs in width. Since four horizontal DLUs equal one average character width, you had to keep your dialog width a multiple of 32 to ensure that the final dialog size was a multiple of eight.

Keeping bitmap widths such that they represented exact byte boundaries was important for performance on the machines of the day. Copying blocks of pixels around was typically performed in three major steps: A thin vertical strip from the left edge of the bitmap to the first byte boundary, then the bulk of the bitmap up to the last byte boundary, and finally a thin vertical strip from the last byte boundary to the right edge. If you kept your eyes open, you could actually see these three stages of drawing occurring. (Like I said, machines of the day weren't all that fast.) Keeping things byte aligned and at byte width meant that the two thin vertical strips had zero width and therefore could be optimized out.

Apple 还规定您应该创建 16x16、32x32 和 128x128 版本的图标。与 Windows 一样,该操作系统可以适应其他尺寸,但您不会获得最佳结果。

来源:http://blogs.msdn.com/b/oldnewthing/archive/2005/08/23/455089.aspx

关于css - 行业标准图标尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26589462/

相关文章:

html - 单击关闭 Accordion 选项卡

html - 带有 CSS 的手机中的 WordPress 导航栏菜单

css - 使用 CSS 增加文本框的大小

html - 如何将我的图标放在我的 div 的中间和中心?

fonts - Twitter bootstrap 3 - 创建自定义字形并添加到字形 "font"

jquery - 如何使用 Jquery 单击标签打开所有 Accordion ?

html - CSS 标题元素之间的意外差距

css - 如何舍入 Font Awesome 图标?

java - 为什么在表格单元格中显示路径而不是图标

Android:作为向上按钮的应用程序图标不起作用