I have created a div which shows an icon and text but I need to get the icon next to the text instead of above it. Currently looks like this:
And I need the icon to be next to the text like this (the icon needs to be displayed to the left of the text without moving the text so the header still aligns with the phone number):
Code:
<div fxLayout="row" fxLayoutAlign="space-around center">
<div>
<mat-icon svgIcon="phone-outline"> </mat-icon>
<h3>Customer Support</h3>
<label>123456</label>
</div>
<div>
<mat-icon svgIcon="email-outline"> </mat-icon>
<h3>Email</h3>
<label>[email protected]</label>
</div>
<div>
<mat-icon svgIcon="map-marker-outline"> </mat-icon>
<h3>Address</h3>
<label>address line 1</label>
</div>
</div>
I have three divs and using fxLayoutAlign aligns them next to each other accoss the page but if I put the icon into a seperate div the fxLayoutAlign moves it too far across the page. Is there a better way to align the divs?
Tried so far:
- Tried putting the icon on the same line as the text but that puts the icon too close to the text:
<h3><mat-icon svgIcon="phone-outline"> </mat-icon> Customer Support</h3>
I need to have space between the icon and text and align it with the text.
- Using CSS to try align still causes the icon to be too close to the text (and not aligned correctly):
.align-items { display: flex; justify-content: space-between; } .align-content { display: flex; align-items: center; }
Moving the icon in CSS using margins looks like its working but it has now moved the second line with the phone number:
The phone number should be directly under the header text (like in first screenshot above)
question from:
https://stackoverflow.com/questions/65904280/position-icon-next-to-text 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…