【问题标题】:Component's are overlapping when placed one below the other in angular当一个组件以角度放置在另一个下方时,组件是重叠的
【发布时间】:2018-09-25 05:49:13
【问题描述】:

我有 2 个组件 称为 1) add-customer 2)edit-customer

我正在使用它们各自的选择器在 app.component.html 文件中显示这两个组件,如下面的代码所示。

<app-add-customer></app-add-customer>
<app-edit-customer></app-edit-customer>

问题在于,edit-customer 组件与 add-customer 组件略有重叠,如下图所示。

我想我缺少一些 css,我尝试了 position 属性,仍然没有结果。这是stackblitz 链接。

【问题讨论】:

  • 你想移动编辑组件吗?
  • 我想将edit-customer 组件移到add-customer 组件下方。您可以在图像中看到 save & cancel 按钮属于“add-customer”组件,它们仍然显示在“edit-customer”中。
  • 查看答案
  • 你已经给出了margin-bottom,我不想使用margin属性来对齐它们。我是怎么得到答案的,谢谢。

标签: css angular angular-material


【解决方案1】:

那是因为您的 .btn-sec div 具有 float: right; 样式。 把它改成text-align: right; 就不会重叠了。

【讨论】:

    猜你喜欢
    • 2022-11-30
    • 1970-01-01
    • 2018-10-18
    • 1970-01-01
    • 2020-04-30
    • 2019-08-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多