TextBox中的行间距

时间:2015-11-13 16:36:26

标签: c# asp.net

有没有办法在TextBox Multiline中设置两行之间的空格? 我试过这个:

<asp:TextBox runat="server" ID="txbdesc" Text='<%# Eval("Descritivo") %>' TextMode="MultiLine" Rows="5" Width="450px" LineSpacing="-9" />

感谢。

2 个答案:

答案 0 :(得分:3)

然后使用TextMode="MultiLine",它将在客户端浏览器中呈现<textarea>元素。可以使用line-height属性使用纯CSS更改textarea中的垂直行间距。

例如,这会使内容加倍:

#txbdesc {
  line-height: 2em;
}

答案 1 :(得分:1)

line-height上设置textarea CSS属性:

&#13;
&#13;
.large {
    line-height: 20px;
}
.small {
    line-height: 10px;
}

textarea {
    width: 100%;
    height: 100px;
    font-size: 10px;
}
&#13;
<textarea class="large">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper orci ligula, vel mattis quam rutrum nec. In sollicitudin mi et laoreet vestibulum. Sed ante dolor, suscipit tincidunt tempor vel, accumsan at nibh. Aliquam erat volutpat. Nullam posuere enim dictum turpis ultrices feugiat. Phasellus convallis vestibulum lacus in tristique.
</textarea>
<textarea class="small">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper orci ligula, vel mattis quam rutrum nec. In sollicitudin mi et laoreet vestibulum. Sed ante dolor, suscipit tincidunt tempor vel, accumsan at nibh. Aliquam erat volutpat. Nullam posuere enim dictum turpis ultrices feugiat. Phasellus convallis vestibulum lacus in tristique.
</textarea>
&#13;
&#13;
&#13;