按钮重叠使用 primeng
Buttons are overlapping using primeng
我正在使用 primeng 按钮,当我在 div 中使用两个按钮时,它们会重叠。
我尝试使用多个 css class 来设置间距。但是,我想如果您使用的是 pButton,则 2 个按钮之间的间距不需要 css class。样式已正确导入,我还导入了 primeng 的 ButtonModule,因为我能够看到按钮的样式。
有人可以帮忙吗?
添加到您的两个按钮样式
style="margin-left:5px;margin-top:2px;text-align: center"
编码愉快!
你可以在按钮 tp 的左右添加边距解决这个问题
style.css
.ui-button {
margin-left: 0.25rem;
margin-right: 0.25rem;
}
所有 primeng 按钮都有这个 class 所以这将影响您项目中的所有按钮
对我来说,所有其他答案都不适用。
[ngStyle]
和我一起工作,我只是像这样将它添加到第一个按钮:
<p-button label="Submit" type="submit" (click)="onSubmit('save')" icon="pi pi-thumbs-up"
styleClass="p-button-success" [ngStyle]="{'margin-right':'8px'}" ></p-button>
我正在使用 primeng 按钮,当我在 div 中使用两个按钮时,它们会重叠。
我尝试使用多个 css class 来设置间距。但是,我想如果您使用的是 pButton,则 2 个按钮之间的间距不需要 css class。样式已正确导入,我还导入了 primeng 的 ButtonModule,因为我能够看到按钮的样式。
有人可以帮忙吗?
添加到您的两个按钮样式
style="margin-left:5px;margin-top:2px;text-align: center"
编码愉快!
你可以在按钮 tp 的左右添加边距解决这个问题
style.css
.ui-button {
margin-left: 0.25rem;
margin-right: 0.25rem;
}
所有 primeng 按钮都有这个 class 所以这将影响您项目中的所有按钮
对我来说,所有其他答案都不适用。
[ngStyle]
和我一起工作,我只是像这样将它添加到第一个按钮:
<p-button label="Submit" type="submit" (click)="onSubmit('save')" icon="pi pi-thumbs-up"
styleClass="p-button-success" [ngStyle]="{'margin-right':'8px'}" ></p-button>