Template:Inline block
此模板目前正依照上的内容进行翻译。 (2019年6月6日) |
用法
The template {{Inline block}} creates an element—by default a <span>
—that has the CSS property display: inline-block;
. There is support for a range of common style properties as template parameters, and an all-purpose style
parameter.
One intended use is to replace {{nowrap}} when coding templates with complex layout, which need to display differently on mobile and desktop. Like {{nowrap}}, it holds content together and avoids wrapping it where possible. However, if necessary, such as on small screens, the content will wrap.
Example of wrapping control编辑
In each case the outline represents a width constraint, which might be affected by the user's screen size, other parts of the template, or both.
Here, each grey box and the text "Color of ..." are wrapped in {{inline block}} templates. If {{nowrap}} had been used instead, there would be no visible difference in the first two cases. In the third case, however, the text would have been unable to wrap into the space available. On mobile, this might mean that a table or the whole article is forced to become horizontally scrollable.
参数编辑
参数 | 说明 | 类型 | 状态 | |
---|---|---|---|---|
Content | 1 | The content to be wrapped in an inline-block element | 内容 | 必填 |
Tag name | 2 | Changes the HTML tag used. This may affect what elements this template should contain or be contained by.
| 字符串 | 可选 |
Title | title | Title of the content (used as tooltip text, or expanded abbreviation when 2=abbr
| 字符串 | 可选 |
Width | width | The width; passed directly to the "width" CSS attribute | 字符串 | 可选 |
Height | height | The height; passed directly to the "height" CSS attribute | 字符串 | 可选 |
Text color | color | The text color; passed directly to the "color" CSS attribute | 字符串 | 可选 |
Background formatting | background bg | The background formatting; passed directly to the "background" CSS attribute | 字符串 | 可选 |
Other styles | style | Style information as plain CSS. | 字符串 | 可选 |
The template {{Inline block}} creates an inline-block element. Among other uses, it can replace {{nowrap}} when coding templates with complex layout.
参数 | 说明 | 类型 | 状态 | |
---|---|---|---|---|
Content | 1 | The content to be wrapped in an inline-block element | 内容 | 必填 |
Tag name | 2 | Changes the HTML tag used. This may affect what elements this template should contain or be contained by.
| 字符串 | 可选 |
Title | title | Title of the content (used as tooltip text, or expanded abbreviation when 2=abbr
| 字符串 | 可选 |
Width | width | The width; passed directly to the "width" CSS attribute | 字符串 | 可选 |
Height | height | The height; passed directly to the "height" CSS attribute | 字符串 | 可选 |
Text color | color | The text color; passed directly to the "color" CSS attribute | 字符串 | 可选 |
Background formatting | background bg | The background formatting; passed directly to the "background" CSS attribute | 字符串 | 可选 |
Other styles | style | Style information as plain CSS. | 字符串 | 可选 |
参见编辑
Template:List of nowrap-like templates
上述文档嵌入自Template:Inline block/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。 本模板的子页面。 |