gpt4 book ai didi

html - 如何在 mat-card-header 的左侧和右侧设置元素组?

转载 作者:太空宇宙 更新时间:2023-11-04 06:31:58 24 4
gpt4 key购买 nike

我需要在左侧和右侧设置标题元素组。

我有这样的东西:

<mat-card-header>

<div fxLayout="row">

<div fxLayout="row" fxLayoutGap="11px" fxLayoutAlign="center center">
<div>Alex Isakau</div>
<a href="https://www.twitter.com/alexisakau">
<img alt="tw" src="../../assets/img/twitter.png" width="40" height="40">
</a>
<a href="https://www.linkedin.com/in/alexisakau/">
<img alt="in" src="../../assets/img/linked.png" width="40" height="40">
</a>
</div>

<div fxLayout="row" fxLayoutGap="11px" fxLayoutAlign="center center">
<div>about</div>
<div>portfolio</div>
<div>contact</div>
</div>

</div>
</mat-card-header>

以及与 mat-card-header 相关的 CSS:

.mat-card {
padding: 0;
}

.mat-card-header {
background-color: rgb(42, 5, 128);
color: white;
padding: 25px 5px 25px;
}

img

添加fxLayoutGap后:

<mat-card-header>
<div fxLayout="row" fxLayoutGap="120%">

img1 img2

就像我说的,它没有响应

最佳答案

你可以通过让你的包装 div fxLayoutAlign 'space-between' 来做到这一点

   <mat-card-header>
<div fxLayout="row" fxFlex="1 0 0" fxLayoutAlign="space-between">
<div fxLayout="row" fxLayoutGap="11px" fxLayoutAlign="center center">
<div>Alex Isakau</div>
<a href="https://www.twitter.com/alexisakau">
<img alt="tw" src="../../assets/img/twitter.png" width="40" height="40">
</a>
<a href="https://www.linkedin.com/in/alexisakau/">
<img alt="in" src="../../assets/img/linked.png" width="40" height="40">
</a>
</div>
<div fxLayout="row" fxLayoutGap="11px" fxLayoutAlign="center center">
<div>about</div>
<div>portfolio</div>
<div>contact</div>
</div>
</div>
</mat-card-header>

margin-left: auto 给你想要向右移动的 div

   <mat-card-header>
<div fxLayout="row" fxFlex="1 0 0">
<div fxLayout="row" fxLayoutGap="11px" fxLayoutAlign="center center">
<div>Alex Isakau</div>
<a href="https://www.twitter.com/alexisakau">
<img alt="tw" src="../../assets/img/twitter.png" width="40" height="40">
</a>
<a href="https://www.linkedin.com/in/alexisakau/">
<img alt="in" src="../../assets/img/linked.png" width="40" height="40">
</a>
</div>
<div fxLayout="row" fxLayoutGap="11px" fxLayoutAlign="center center" style="margin-left:auto">
<div>about</div>
<div>portfolio</div>
<div>contact</div>
</div>
</div>
</mat-card-header>

并且在这两种情况下,通过提供 fxFlex="1 0 0"

使包装器 div flex-grow: 1

关于html - 如何在 mat-card-header 的左侧和右侧设置元素组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54594374/

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