Joh*_*ohn 2 css angular-material2
如何通过将文本包装在按钮内来确保Angular Material Button内的文本不会溢出。我尝试了以下方法:
<div class="cotnainer">
<button mat-raised-button color="accent">Click me! This is a long text, but I want to to wrap if content is overflowing
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
.container{
width: 200px;
height:200px;
background-color: silver;
}
button{
max-width: 100%;
}
span, .mat-button-wrapper{ // I have tried all of the following options, but it does not work.
max-width: 100% !important;
word-break: break-all !important;
overflow: hidden !important;
}
Run Code Online (Sandbox Code Playgroud)
这是一个Stackblitz
编辑 当前结果:
您可以使用以下代码实现此目的:
隐藏:
button {
overflow-x: hidden !important;
}
Run Code Online (Sandbox Code Playgroud)
断词:
button{
white-space: pre-wrap !important;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2722 次 |
| 最近记录: |