Ngprime 修复按钮的大小
我正在构建一些 primeng 按钮,但它们对于我的项目来说太大了。我在文档中看到我可以使用
<p-button label="Small" icon="pi pi-check" styleClass="p-button-sm"></p-button>
但是当我使用这些按钮的其他属性时,我正在使用
<button>
而不是
<p-button>
尝试使用样式(宽度和高度),但按钮内的文本不会改变其大小。有办法实现这一点吗?我附上按钮的代码:
<span class="p-buttonset">
<button pButton pRipple label="Mapa" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;" (click)="cambiarTipo(0)" ></button>
<button pButton pRipple label="Satélite" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color: darkslategray;" (click)="cambiarTipo(1)"></button>
</span>
<button pButton pRipple label="Zonas prohibidas" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;" (click)="prohibidas()"></button>
<button pButton pRipple label="Ver puntos" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;" (click)="mostrarTabla()">
</button>
<div class="p-inputgroup" >
<p-inputNumber inputStyleClass="black" [(ngModel)]="tiempoIsocronas" mode="decimal" placeholder="Tiempo isocronas"
[useGrouping]="false" [disabled]="lista.length!=1" [inputStyle]="{border:'1px solid darkslategray',background:'rgba(255, 255, 255, .65)'}">
</p-inputNumber> <button pButton pRipple type="button" icon="pi pi-search"
class="p-button-outlined p-button-secondary" (click)="llamarServicio(listaMetodos.isocronas)"
[disabled]="lista.length!=1" style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;">
</button> </div>
I am building some primeng buttons but they are too big for my project. I have seen in the documentation that I can use
<p-button label="Small" icon="pi pi-check" styleClass="p-button-sm"></p-button>
But as I am using other properties of those buttons, I am using
<button>
instead of
<p-button>
I have tried using styles (width and height) but the text inside the button does not change its size. Is there a way to achieve this? I attach the code of my buttons:
<span class="p-buttonset">
<button pButton pRipple label="Mapa" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;" (click)="cambiarTipo(0)" ></button>
<button pButton pRipple label="Satélite" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color: darkslategray;" (click)="cambiarTipo(1)"></button>
</span>
<button pButton pRipple label="Zonas prohibidas" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;" (click)="prohibidas()"></button>
<button pButton pRipple label="Ver puntos" class="p-button-outlined p-button-secondary"
style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;" (click)="mostrarTabla()">
</button>
<div class="p-inputgroup" >
<p-inputNumber inputStyleClass="black" [(ngModel)]="tiempoIsocronas" mode="decimal" placeholder="Tiempo isocronas"
[useGrouping]="false" [disabled]="lista.length!=1" [inputStyle]="{border:'1px solid darkslategray',background:'rgba(255, 255, 255, .65)'}">
</p-inputNumber> <button pButton pRipple type="button" icon="pi pi-search"
class="p-button-outlined p-button-secondary" (click)="llamarServicio(listaMetodos.isocronas)"
[disabled]="lista.length!=1" style="background-color: rgba(255, 255, 255, .65); color:darkslategray ;">
</button> </div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题。官方网站 https://primeng.org/theming 上的文档建议对我有用的答案是,在你的主 CSS 文件中:
组件最初基于 16px 的字体大小,所以我个人使用了 12 并且喜欢它。但是,这将更改应用程序中所有组件的大小。如果您只想更改按钮的大小,您可以使用以下命令将它们隔离
I experienced a similar issue. The answer from the documentation on the official site https://primeng.org/theming recommends which worked for me was, in your primary CSS file:
The components are initially based on a font size of 16px, so I personally used 12 and liked it. However, this will change the sizing of all the components in your app. If you are looking only to change the size of the buttons you can isolate them instead with