CSS Layout Issue with Heading Placement
I’m working on a travel card component but struggling with the layout. I want the title to appear underneath the location details instead of next to them.
What I want: The heading should be positioned below the location icon and text, creating a vertical stack.
Current problem: Everything is displaying horizontally in a single row.
Here’s my React component:
import { FaMapMarkerAlt } from "react-icons/fa"
<div className="travel-card">
<img src="https://source.unsplash.com/320x240/nature" className="destination-image" alt="travel-destination" />
<div className="info-section">
<FaMapMarkerAlt />
<span>ICELAND</span>
<span className="map-link">See on Map</span>
<div className="title-wrapper">
<h2>Northern Lights</h2>
</div>
</div>
</div>
And my CSS:
.travel-card {
display: flex;
align-items: flex-start;
gap: 15px;
}
.destination-image {
height: 200px;
width: 150px;
border-radius: 8px;
object-fit: cover;
}
.info-section {
display: flex;
align-items: baseline;
gap: 10px;
}
.title-wrapper {
display: inline-block;
}
.map-link {
text-decoration: underline;
color: #666;
}
How can I modify the CSS to make the heading drop to the next line below the location information?