0

这是此处的问答的后续内容。

有没有办法控制跨度中间线内的填充?这有点难以解释,但也许我的小提琴会帮助演示。因此,如果文本跨越 3 行,我可以在第一行的开头和最后一行的结尾添加填充,并在 CSS 中为跨度添加填充。但中间行的文字拥抱背景颜色。

我能不能像第一条和最后一条一样在中间线上填充?

目标看起来与此类似:

<h1>
<span>I can pad the beginning of the first line and end of the last line, but middle lines hug the edge!</span>
</h1>
h1{
    width:350px;
    margin: 5px;
    text-align: center;
}
h1 span
{
    background-color: #5577aa;
    color: #fff;
    line-height:32px;
    padding: 5px 25px 5px 35px;
    -moz-border-radius: 13px;
    font-size: 12pt;
    font-weight: bold;
    font-family: 'Arial', sans;
    text-align: center;
}
4

1 回答 1

4

您不能随意添加边框半径或填充到自动换行,因为 HTML 元素实际上并没有结束。如果您想要图表中的内容,则需要使用三个元素。

于 2012-05-25T15:53:31.100 回答