全站通知:
模板:压缩文本
刷
历
编
跳到导航
跳到搜索
所有模板列表
使用本模板以自动将文本压缩,使其完整显示在容器内。
实际是对具有.scaledtext类的元素应用压缩变换,代码见Widget:TextScaling。
{{scaledtext}}重定向至此。
- 示例
- 放置于指定宽度的容器元素内(添加边框以方便确认容器尺寸)
<div style="border:1px dashed #404142;width:160px;overflow:hidden;white-space:nowrap;">{{压缩文本|Coffined chill taste. Eros he childe below him.}}</div>
- 放置于指定最大宽度的表格单元格内
{| class="wikitable"
| style="max-width:160px;overflow:hidden;white-space:nowrap;"|{{压缩文本|Coffined chill taste. Eros he childe below him.}}
|}
- 添加自定义样式
<div style="width:160px;overflow:hidden;white-space:nowrap;">{{压缩文本|Coffined chill taste. Eros he childe below him.|css=background:#E9EAF3;}}</div>
注:压缩时会追加以下样式以确保效果,故不支持以下样式的自定义:
element.style {
display: inline-block;
width: [计算得出的文本原始宽度];
transform: scaleX([计算得出的压缩比例]);
transform-origin: left center;
white-space: nowrap;
margin: 0;
padding: 0;
vertical-align: bottom;
}
所有模板列表

沪公网安备 31011002002714 号