Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
html按钮中的文本连字号_Html_Css_Button_Text_Hyphenation - Fatal编程技术网

html按钮中的文本连字号

html按钮中的文本连字号,html,css,button,text,hyphenation,Html,Css,Button,Text,Hyphenation,我有一个固定宽度的按钮。在该按钮内有一个带有名称的标签。 名称是可变的,它可以长于按钮的宽度 在浏览器中查看时,较长的文本不适合按钮。 有没有办法将按钮文本连字符?文本没有“空格”,但有下划线:“\u0”。您可以使用css属性指定用于表示剪裁文本的自定义字符串。比如说, HTML 您要找的是下面的文本:“'。要使文本溢出,请使用以下CSS: button{ width:100px; overflow: hidden; text-overflow: '_'; white-spa

我有一个固定宽度的按钮。在该按钮内有一个带有名称的
标签。 名称是可变的,它可以长于按钮的宽度

在浏览器中查看时,较长的文本不适合按钮。 有没有办法将按钮文本连字符?文本没有“空格”,但有下划线:“\u0”。

您可以使用css属性指定用于表示剪裁文本的自定义字符串。比如说,

HTML


您要找的是下面的
文本:“'。要使文本溢出,请使用以下CSS:

button{
    width:100px;
  overflow: hidden;
  text-overflow: '_';
  white-space: nowrap;
}    

<button>My text is to long for me!</button>
按钮{
宽度:100px;
溢出:隐藏;
文本溢出:'";
空白:nowrap;
}    
我的文字太长了!


省略号(…)也可以由下面的
文本使用:省略号

是的,您可以使用“连字符”CSS属性实现这一点


我猜您希望在“有限宽度”按钮中显示长文本。首先看一下

CSS

#test{
  display: block;
  width:100px;
  height:30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-all;
  word-wrap: break-word;
}
HTML

<button type="button" id="test">text_hyphenation_within_a_html_button</button>
text\u连字符\u在\u html\u按钮中

这是您要查找的吗?是否要在单词断开时显示连字符,或显示它以指示某些文本被隐藏。。?你所说的“在这个按钮中有一个带有名字的标签”是什么意思?什么标签。。?你能添加一些示例代码和更好的描述吗。。?希望答案有助于在下划线后打断文本是允许的吗?如果你真的是指断字,那么手动添加断字提示可以吗,或者你应该能够以编程的方式添加断字提示吗?按钮中文本的语言是否已知?只需补充,这是连字符的浏览器兼容性:
.button{
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
width:90px;
}
#test{
  display: block;
  width:100px;
  height:30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-all;
  word-wrap: break-word;
}
<button type="button" id="test">text_hyphenation_within_a_html_button</button>