如何包装与固定宽度的html按钮的文本 [英] How to wrap text of html button with fixed width

查看:134
本文介绍了如何包装与固定宽度的html按钮的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只注意到,如果你给一个HTML按钮固定宽度,按钮内的文本是从来没有包裹。我和自动换行试过,但这个词的削减,即使有可用于包装上。空格

I just noticed that if you give a html button a fixed width, the text inside the button is never wrapped. I've tried it with word-wrap, but that cuts of the word even though there are spaces available to wrap on.

我怎样才能让一个HTML按钮上的文字有一个固定的宽度包装就像任何的TableCell会吗?

How can I make the text of an html button with a fixed width wrap like any tablecell would?

<td class="category_column">
    <input type="submit" name="ctl00$ContentPlaceHolder1$DataList1$ctl12$ProCat_NameButton" 
           value="Roos Sturingen / Sensors" 
           id="ctl00_ContentPlaceHolder1_DataList1_ctl12_ProCat_NameButton" 
           class="outset" 
           style="height:118px;width:200px;font-size:18px;color:#7F7F7F;width:200px;white-space:pre;" />
</td>

CSS类做什么,但添加边框和修改的边距。
如果我添加单词换行:打破字这个按钮,它会包装它是这样的:

the css classes do nothing but adding borders and modify the padding. If I add word-wrap:break-word to this button, it will wrap it like this:

Roos Sturingen / Sen
sors

和我不希望它在一个字的中间剪开,如果有可能把它割下单词之间。

And I dont want it to cut of in the middle of a word if it is possible to cut it off between words.

感谢

推荐答案

我发现你可以使用空白CSS属性:

I found that you can make use of the white-space css property:

white-space: normal;

和它将打破字作为普通文本。

And it will break the words as normal text.

希望它帮助。

这篇关于如何包装与固定宽度的html按钮的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆