我正在尝试减小垫高按钮的大小。我以为我可以通过减小文本的大小来减小按钮的大小。但我无能为力。
这是CSS:
button {
margin-right: 1vw;
background: #4285F4;
color: white;
font-size: 9px;
height: auto;
width: auto;
}
Run Code Online (Sandbox Code Playgroud)
和模板:
<button mat-raised-button class="button"><span>Click here to submit</span></button>
Run Code Online (Sandbox Code Playgroud)
你在正确的轨道上。除了字体大小,您还需要更改行高:
button{
margin-right: 1vw;
background: #4285F4;
color: white;
font-size: 9px;
line-height: 18px;
height: auto;
width: auto;
}
Run Code Online (Sandbox Code Playgroud)
https://stackblitz.com/edit/angular-fmgfn1
小智 0
将 更改width: auto;为指定单位,例如px、em或rem。
例如将宽度更改为200px
button {
margin-right: 1vw;
background: #4285F4;
color: white;
font-size: 9px;
height: auto;
width: 200px;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6134 次 |
| 最近记录: |