I searched but couldn’t find a question quite like mine. Apologies if there’s an answer somewhere.
I’m attempting to do a very simple flex layout in row format where 2 containers are side by side. I have a card component with an ngFor loop inside another component. Here’s my code:
top-cta-HTML:
<section id="cta-container">
<h1>Take Control of Your Financial Future</h1>
<h4>
Whether you’re looking at annuities to guarantee future income, <br />save
for a life change, or selling your structured settlement,<br />
we’re here to help with guidance, advice, and experience
</h4>
<app-cta-card></app-cta-card>
</section>
top-cta-CSS:
#cta-container {
margin: 2.5rem 0 0 auto;
padding: 0 20px 0 5px;
background-color: orange;
width: 35%;
border-bottom-left-radius: 60px;
text-align: end;
}
#cta-container h1 {
font-size: 2.75rem;
font-weight: 900;
}
#cta-container h4 {
margin-top: -20px;
font-size: 1.2rem;
font-weight: 500;
line-height: 1.5em;
}
card-HTML:
<article id="card-parent-container">
<div class="top-cta-card" *ngFor="let card of ctaCards">
<div class="cta-card-topper">1</div>
<h3>{{ card.title }}</h3>
<a href="#" class="top-cta-links">➔</a>
<p>{{ card.description }}</p>
</div>
</article>
card-CSS:
.top-cta-card {
background-color: var(--cream);
width: 300px;
}
#card-parent-container {
display: flex;
flex-direction: column;
}
.cta-card-topper {
background-color: var(--teal);
height: 100%;
width: 100%;
color: var(--teal);
}
.top-cta-links {
background-color: var(--teal);
color: var(--cream);
padding: 5px 6px;
border-radius: 50%;
box-shadow: 3px 2px 3px var(--gunMetal50);
}
This code produces 2 cards stacked on top of each other and no matter what I change they won’t sit in row format.
As a test, I made 2 divs inside the top-cta-HTML file with no ngFor loop and got the desired result. Any ideas here on what I’m doing wrong?
Here is a Stack Blitz link that might help since you can visualize the issue https://stackblitz.com/edit/angular-yogk3e
Thank you for any and all help, I really appreciate it!