gpt4 book ai didi

css - 在 Angular 中为组件添加自定义样式

转载 作者:太空宇宙 更新时间:2023-11-04 00:38:49 25 4
gpt4 key购买 nike

我还是 Angular 7 的新手。我有一个带有标题指令和 div 的表单。我试图将它们都设置在同一行中,并在表单侧面设置 49% 的宽度。 div 样式工作正常,但在 title 组件中不采用该样式。问题是我只需要更改当前表单中的 title 指令。有什么办法吗?非常感谢

<form #taskForm="ngForm" (ngSubmit)="onSubmit()">

<my-title [style.width]='49%' [title]="'title.page'" [wikiUrl]='wikiUrl' icon="work">
</my-title>

<div [style.width]='49%'>
<button>Save</button>
</div>

</form>

最佳答案

添加几乎等于 49% 的 px。

 <div [ngStyle]="{'width.px': 490px}"> 
<button>Save</button>
</div>

关于css - 在 Angular 中为组件添加自定义样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58765075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com