我想知道是否有其他解决方案:
How to remove the space between inline-block elements?
用于在<span>
标记位于<template is="dom-repeat">
时删除空格。
例如,假设我们有一个dom-repeat生成一个表列标题:
<th class="asciitable">
<template is="dom-repeat" items="[[_asciiheader]]">
<span class="asciinumeral">[[item]]</span>
</template>
</th>
我们希望所有元素都显示为“12345678”,而不是“1 2 3 4 5 6 7 8”。
上述内容符合“无权访问HTML”的情况,因为dom-repeat
会为我们生成HTML,因此我们无法将<span>
标记放在同一位置行,或使用<!--\n-->
技巧。注意我们必须将数据绑定包装在某些东西中,在这种情况下为<span>
,因为Polymer 1.0在数据绑定之前或之后不需要空格。
唯一可行的方法是做上面的链接建议:
.asciitable {
padding: 0px;
border-width: 0px;
margin: 0px;
font-size: 0;
}
.asciinumeral, .ascii {
font-size: 16px;
}
但这似乎不太理想。
答案 0 :(得分:3)
如何在一条线上写下所有内容?
<template is="dom-repeat" items="[[_asciiheader]]"><span class="asciinumeral">[[item]]</span></template>
这应该给你没有空格的数字。