html - 如何以角度更改按钮位置?
问题描述
我想更改我的 html 代码中的按钮位置,但我在 j 中遇到了问题,如下图所示!我想把按钮放在模态的页脚!
这是我的代码:
<div class="modal-header" >
<h6 class="modal-title" id="modal-basic-title">Notes</h6>
<button type="button" class="close" aria-label="Close" (click)="closemodal()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="width:500px ; height:600px; overflow-y: auto" >
<mat-accordion >
<mat-expansion-panel *ngFor="let i of listCategorie" class="parentPanel" >
<mat-expansion-panel-header class="parentPanel_header" (click)="getSouCategories(i.id)" >
<mat-panel-title > {{i.libelle}} {{i.id}}
<span class="badge badge-light " style="position:absolute; right:6em"> {{listCategorie.length}} </span>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-accordion multi>
<mat-expansion-panel style="background-color: #EEDFF5;" class="childPanel childPanelCount" [expanded]="true" hideToggle disabled>
<div class="d-flex mt-2">
<div class="p-2"><p> Nombre des sous catégories </p></div>
<div class="ml-auto p-2">
<span class="badge badge-secondary "> {{listSousCategorie.length}} </span>
</div>
</div>
</mat-expansion-panel>
<ng-container>
<mat-expansion-panel class="childPanel" [expanded]="true" hideToggle disabled style=" background:#F2EDFF;"
*ngFor="let j of listSousCategorie; ">
<div class="childPanel_body2 mat-badge-large" fxLayout="row" fxFlex fxLayoutAlign="start center">
<div style="padding-left:1em" fxFlex="grow">{{j.libelle}} {{j.id}}</div>
<mat-form-field style="width:50px" appearance="standard">
<form>
<mat-label>Note</mat-label>
<input type="text" matInput name="Note" [(ngModel)]="j.Note_Condidat">
<button type="button" (click)="onSubmit(j)"> ok</button>
</form>
</mat-form-field>
</div>
</mat-expansion-panel>
</ng-container>
</mat-accordion>
</mat-expansion-panel>
</mat-accordion>
</div>
TS 文件:
onSubmit(sous) {
this.LExamenSousCategorieService.updateSouCategorie(sous).then(res => {
})
}
解决方案
我认为你应该给按钮“位置:相对”的父元素,并用“位置:绝对;(和边距,填充与......)”来定位按钮
推荐阅读
- javascript - 为什么我在运行 METEOR 时在 modules.js 中收到 SytaxError?
- google-chrome-extension - chrome.tabs.getCurrent 返回未定义
- python-3.x - 改变先知情节的特点
- c# - 在 AutoCAD 中打开一个 dwg 文件并通过 C# 滚动到 dwg 地图的特定位置
- python - 什么是属性?它如何“保持”一个价值?
- html - 如果在 d3.js 中有阴影,则在 svg 中的 svg 中的 ForeignObject 中的选择框不会重新绘制/更新
- android - 使用 Dagger 时将数据传递给 ViewModel
- python - AttributeError: 'Event' object has no attribute 'setEvent'
- sql - 如何在相对论中查询样本?
- regex - Google 表格 ImportXML 以显示标题并嵌入 URL