9.11.2011

网站开发日志: 如何让图标垂直居中

2. 使用CSS背景属性 使用CSS背景属性应该算是最标准的方法,使用它我们可以给文本标题加上特色图标。这种方法在给文本列表加上图标时尤其常用。当然我们还是要注意行高、图标尺寸和字体大小等因素,前面的建议在这种方法里依然适用。例如:

 请选择频道进入

请选择频道进入

I add the relevant white-space value inline.

nowrap

This value suppresses all line breaks in the element, except where it contains <br />s or <wbr />s.

This is the test paragraph with white-space: nowrap. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?

If the line of code stretches beyond the right border of the page, the browser should generate a horizontal scrollbar.

pre

This value makes the element behave as a <pre>: all line breaks, tabs and other oddities of the source code are literally followed.

This is the test paragraph with white-space: pre. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?

pre-wrap

This value behaves as the pre value, except that it adds extra line breaks to prevent the text breaking out of the element's box.

This is the test paragraph with white-space: pre-wrap. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?

Opera renders it like this:

Screenshot: whitespace: pre-wrap in actionwhitespace: pre-wrap in action

pre-line

As far as I understand this value ignores tabs and multiple spaces, but it breaks off the text at hard returns in the source code, as well as when it's necessary to prevent the text from breaking out of its box.

This is the test paragraph with white-space: pre-line. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?

iCab renders it like this:

Screenshot: whitespace: pre-line in actionwhitespace: pre-line in action
Home Sitemap Contact Donations

Fronteers

Valid XHTML 1.0

2. 使用CSS背景属性 使用CSS背景属性应该算是最标准的方法,使用它我们可以给文本标题加上特色图标。这种方法在给文本列表加上图标时尤其常用。当然我们还是要注意行高、图标尺寸和字体大小等因素,前面的建议在这种方法里依然适用。例如:  请选择频道进入 请选择频道进入 I add the relevant white-space value inline. nowrap This value suppresses all line breaks in the element, except where it contains
s or s. This is the ...» more Dogmeat