[英]Button overflow hidden not working
我有以下内容:
HTML:
<button>Here's a long chunk of text</button>
CSS:
button {
width: 80px;
overflow: hidden;
}
基本上,我希望按钮不包装文本..
我敢肯定我只是遗漏了一些明显的东西,但我无法弄明白......
你可以使用white-space: nowrap;
:
button { width: 80px; overflow: hidden; white-space: nowrap; }
<button>Here's a long chunk of text</button>
添加white-space: nowrap;
和word-wrap: normal;
word-wrap:
自动换行属性允许长单词被打破并换行到下一行。
white-space:
white-space属性指定如何处理元素内的空白。
button { width: 80px; overflow: hidden; white-space: nowrap; word-wrap: normal; }
<button>Here's a long chunk of text</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.