Hey everyone, I’m having an issue where header card images are displaying alongside the text content in a split layout instead of as background images. The cards have the correct structure with a <picture> element as a direct child of the .kg-header-card, but Ghost’s CSS seems to be forcing a flex layout that puts the image and content side by side.
The Problem
When I inspect the rendered HTML, header cards look like this:
<div class="kg-card kg-header-card kg-v2 kg-width-full">
<picture>
<img src="https://example.com/image.jpg" class="kg-header-card-image">
</picture>
<div class="kg-header-card-content">
<h2 class="kg-header-card-heading">My Heading</h2>
<h3 class="kg-header-card-subheading">My Subheading</h3>
<a href="#" class="kg-header-card-button">Button Text</a>
</div>
</div>
The structure looks correct (picture is a direct child of the card, not inside the content div), but the rendered result shows the image and text side by side in a split layout, rather than the image as a background behind the text.
What I’ve Tried
-
Removed
kg-layout-splitclass - This class was present and I removed it, but the side-by-side layout persists. -
Tried
data-kg-background-imageattribute - Switched to using Ghost’s native background image attribute, removed the picture element. Result: Full width card but no background image at all. -
Added CSS to override flex layout - Tried forcing
display: blockandflex-direction: unsetwith!important:
.kg-header-card {
display: block !important;
flex-direction: unset !important;
}
Still showing side by side.
-
Wrapped in container div - Following the approach from spectralwebservices, wrapped cards in a container div and targeted with CSS. No change.
-
Positioned picture absolutely - Tried making the picture element
position: absolutewithz-index: 0and content atz-index: 1. Ghost’s flex layout still overrides it.
What I’m Seeing in the Inspector
When I inspect the rendered page:
- The card has
display: flexapplied (fromcards.muin.css) - The picture element and content div are flex children, causing the side-by-side layout
- Even with
!importantflags, I can’t seem to override Ghost’s flex layout - The
kg-layout-splitclass is removed, but the split behavior persists
Questions
-
Is there a specific class or attribute that tells Ghost to render header cards with background images vs split layout? The docs mention
kg-style-image- does that need to be present? -
How does Ghost’s default CSS determine whether to show an image as background vs side-by-side? Is it based on the presence of
data-kg-background-image, or something else? -
Are there theme-specific CSS rules I should be aware of? I’m using a custom theme - could it be overriding the default header card behavior?
-
Has anyone successfully overridden Ghost’s flex layout for header cards to force background image display? What CSS specificity was needed?
The structure matches what I see in the Ghost docs, but the rendering doesn’t. Any insights would be super helpful!
Thanks,
Nic
