Test365i
365i.co.uk
Back to all guides
Elementor

A clickable card grid with the Elementor 4 Collection loop

The Elementor 4 Collection loop repeats one design for every post a query finds. On this site it lists the build guides, which are a JetEngine post type, in the element gallery, the Lab and the mega menu, all from one card component. This guide builds that grid, makes each whole card clickable and hides fields that come back empty.

e-collection-loop

Live demo: the card grid

Elementor

Style the Elementor 4 Carousel element: arrows, dots and loop

The Elementor 4 Carousel element gives you slides, arrows and dots as separate atomic parts. Out of the box on this site, the arrows sat on top of the slide titles, the active dot was black on a dark panel and Loop did nothing. This guide fixes all three, with the CSS the element gallery now runs.

20 minutes Get the guide
Elementor

The Elementor 4 Accordion element, built on native details

The Elementor 4 Accordion element is built on the browser's own details and summary elements, so it opens and closes with no script. This guide sets it up the way the element gallery on this site does, styles it with classes, and explains the FAQ schema switch and what Google now does with it.

15 minutes Get the guide

25 minutesCustom codeElementorElementor ProJetEngine

Works on WordPress 7.2, Elementor 4.4.2, Elementor Pro 4.4.2 and JetEngine 3.9.1.3

Editorial integrity: read our editorial standards.

  1. Point the Collection loop at your post type

    Drag in the Collection loop. It holds a layout, the layout holds one item, and whatever you put in that item is repeated for every post. Under the query settings, set the source to your post type. Here that is Experiments, the post type behind these guides, which I created with JetEngine in the JetEngine REST guide.

    The gallery shows the two newest guides. These are the query values it stores, which the editor shows as source, posts per page, order by and order:

    A query box reading the JetEngine post type, feeding a layout that repeats one card per post
    The query picks the posts; the loop repeats one card for each.
    loop-query.jsonJSON
    {
    	"template_type": "post",
    	"source": "experiment",
    	"posts_per_page": 2,
    	"orderby": "post_date",
    	"order": "desc"
    }

    Elementor's own help article answers the first question most people have:

    The Atomic Loop architecture requires an active Elementor Pro license.

    Elementor, How to Use the Atomic Loop

    So this is a Pro build. JetEngine is a separate plugin here, and its only job is to supply the post type and its fields; the loop, the query and the component all come from Elementor Pro.

  2. Build the card once as a component

    Inside the loop item, build the card from a Div block with its tag set to article, a Paragraph for the topic, a Heading, a Paragraph for the summary and a footer row. Bind each one to a dynamic tag: the topic term, the post title, the excerpt, the time-needed field and a link to the post.

    Then save the card as a component. This site uses the same card component on Home, in the Lab and in the gallery, so one edit changes every card. This is the markup the loop prints for two cards, simplified, with the second card's topic left empty on purpose for step 6:

    card.htmlHTML
    <div class="loop-grid" role="list">
    	<div role="listitem">
    		<article class="loop-card">
    			<span class="loop-card-topic">Elementor</span>
    			<h3 class="loop-card-title">Style the Elementor 4 Carousel element: arrows, dots and loop</h3>
    			<p class="loop-card-text">The arrows sat on top of the slide titles, the active dot was black and Loop did nothing. This guide fixes all three.</p>
    			<div class="loop-card-foot">
    				<span>20 minutes</span>
    				<span class="loop-card-link"><a href="https://www.test365i.co.uk/lab/elementor-4-carousel-element/">Get the guide</a></span>
    			</div>
    		</article>
    	</div>
    	<div role="listitem">
    		<article class="loop-card">
    			<span class="loop-card-topic"></span>
    			<h3 class="loop-card-title">The Elementor 4 Accordion element, built on native details</h3>
    			<p class="loop-card-text">Built on the browser's own details and summary elements, so it opens and closes with no script.</p>
    			<div class="loop-card-foot">
    				<span>15 minutes</span>
    				<span class="loop-card-link"><a href="https://www.test365i.co.uk/lab/elementor-4-accordion-element/">Get the guide</a></span>
    			</div>
    		</article>
    	</div>
    </div>
    After step 2: the markup on its own, before any CSS. The second card's topic is empty, so nothing shows above its title yet.
  3. Lay the items out in a grid

    Give the loop layout the class loop-grid and the card the class loop-card. The gallery on this site uses two fixed columns and one on phones. auto-fit with a 240px minimum gets the same result without a breakpoint, and it also works when the loop sits in a narrow column, like the preview below. The footer's margin-top: auto lines the footers up when the summaries are different lengths.

    loop.cssCSS
    .loop-grid {
    	display: grid;
    	grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    	gap: 12px;
    }
    
    .loop-card {
    	box-sizing: border-box;
    	display: flex;
    	flex-direction: column;
    	gap: 10px;
    	height: 100%;
    	padding: 24px;
    	border: 1px solid rgba(255, 255, 255, 0.12);
    	border-radius: 16px;
    	background: rgba(255, 255, 255, 0.04);
    }
    
    .loop-card-topic {
    	align-self: flex-start;
    	padding: 4px 10px;
    	border: 1px solid rgba(247, 87, 189, 0.4);
    	border-radius: 999px;
    	font: 12px/1.2 ui-monospace, monospace;
    	color: #F757BD;
    }
    
    .loop-card-title {
    	margin: 0;
    	font-size: 20px;
    	line-height: 1.25;
    	color: #F6F6FC;
    }
    
    .loop-card-text {
    	margin: 0;
    	font-size: 14px;
    	line-height: 1.55;
    	color: #BBBBD1;
    }
    
    .loop-card-foot {
    	display: flex;
    	justify-content: space-between;
    	gap: 12px;
    	margin-top: auto;
    	font-size: 13px;
    	color: #8F90A7;
    }
    After step 3: two cards in a grid. The second card shows an empty topic pill.
  4. Make the whole card clickable

    The card keeps one real link, "Get the guide", and that link's ::after is stretched over the whole card with position: absolute and inset: 0. The card needs position: relative so the stretch stops at its edges. There is still only one link per card, so keyboard users meet one Tab stop per card rather than four.

    loop.cssCSS
    .loop-card {
    	position: relative;
    	transition: border-color 0.2s ease;
    }
    
    .loop-card:hover {
    	border-color: rgba(255, 255, 255, 0.28);
    }
    
    .loop-card-link a {
    	font-weight: 600;
    	color: #35D0FF;
    	text-decoration: none;
    }
    
    .loop-card-link a:hover {
    	color: #8FE6FF;
    }
    
    .loop-card-link a::after {
    	content: "";
    	position: absolute;
    	inset: 0;
    	z-index: 1;
    	border-radius: inherit;
    }
    After step 4: point anywhere on a card and it acts as one link.

    Heydon Pickering describes this exact technique in his Inclusive Components article on cards:

    This stretches the link's layout over the whole card, making it clickable like a button.

    Heydon Pickering, Inclusive Components, "Cards"

    The point of doing it this way, rather than wrapping the whole card in a link, is what a screen reader hears. A wrapped card reads every word in it as the link name; a stretched link reads only its own text, and the rest of the card stays ordinary content.

  5. Put the focus ring round the whole card

    Because the whole card is the click target, the focus ring belongs on the whole card too. :has() lets the card react when its link has keyboard focus, and the link's own outline is removed so there is only one ring. Both rules sit inside @supports, so a browser without :has() keeps the link's normal outline instead of losing the ring entirely.

    loop.cssCSS
    @supports selector(:has(*)) {
    	.loop-card:has(.loop-card-link a:focus-visible) {
    		outline: 2px solid #35D0FF;
    		outline-offset: 3px;
    	}
    
    	.loop-card-link a:focus-visible {
    		outline: none;
    	}
    }
    After step 5: click in the preview, then press Tab. The ring goes round the whole card.
  6. Hide fields that come back empty

    A dynamic field with nothing in it still prints its element, so an untagged post shows an empty pill. :empty hides it. Loop items in Elementor 4 carry no post classes, so this cannot be done per post; the same limit is why the topic badges on this site colour themselves with :has() and the link they hold. The grid at the top of this guide is the real Collection loop with the same card component, set to a manual selection of two guides so it never lists the page it sits on. It also runs in the element gallery.

    loop.cssCSS
    .loop-card-topic:empty,
    .loop-card-text:empty {
    	display: none;
    }
    
    @media (prefers-reduced-motion: reduce) {
    	.loop-card {
    		transition: none;
    	}
    }
    After step 6: the empty topic pill on the second card is gone.

What this collection loop setup does not do

It needs Elementor Pro, as Elementor's help article says.

Text inside a stretched-link card cannot be selected with the mouse, a trade-off Adrian Roselli also points out.

Every card's link says "Get the guide", so someone listing the links on the page hears the same name twice. Linking the title instead, as Heydon Pickering's cards do, gives each link a unique name.

:empty only matches an element with nothing at all inside it, not even a space.

All the code for this card grid

Each file below is complete. Copy it, or download it under the name shown.

loop-query.jsonJSON
{
	"template_type": "post",
	"source": "experiment",
	"posts_per_page": 2,
	"orderby": "post_date",
	"order": "desc"
}
card.htmlHTML
<div class="loop-grid" role="list">
	<div role="listitem">
		<article class="loop-card">
			<span class="loop-card-topic">Elementor</span>
			<h3 class="loop-card-title">Style the Elementor 4 Carousel element: arrows, dots and loop</h3>
			<p class="loop-card-text">The arrows sat on top of the slide titles, the active dot was black and Loop did nothing. This guide fixes all three.</p>
			<div class="loop-card-foot">
				<span>20 minutes</span>
				<span class="loop-card-link"><a href="https://www.test365i.co.uk/lab/elementor-4-carousel-element/">Get the guide</a></span>
			</div>
		</article>
	</div>
	<div role="listitem">
		<article class="loop-card">
			<span class="loop-card-topic"></span>
			<h3 class="loop-card-title">The Elementor 4 Accordion element, built on native details</h3>
			<p class="loop-card-text">Built on the browser's own details and summary elements, so it opens and closes with no script.</p>
			<div class="loop-card-foot">
				<span>15 minutes</span>
				<span class="loop-card-link"><a href="https://www.test365i.co.uk/lab/elementor-4-accordion-element/">Get the guide</a></span>
			</div>
		</article>
	</div>
</div>
loop.cssCSS
.loop-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
	gap: 12px;
}

.loop-card {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: 100%;
	padding: 24px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.04);
}

.loop-card-topic {
	align-self: flex-start;
	padding: 4px 10px;
	border: 1px solid rgba(247, 87, 189, 0.4);
	border-radius: 999px;
	font: 12px/1.2 ui-monospace, monospace;
	color: #F757BD;
}

.loop-card-title {
	margin: 0;
	font-size: 20px;
	line-height: 1.25;
	color: #F6F6FC;
}

.loop-card-text {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: #BBBBD1;
}

.loop-card-foot {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	font-size: 13px;
	color: #8F90A7;
}

.loop-card {
	position: relative;
	transition: border-color 0.2s ease;
}

.loop-card:hover {
	border-color: rgba(255, 255, 255, 0.28);
}

.loop-card-link a {
	font-weight: 600;
	color: #35D0FF;
	text-decoration: none;
}

.loop-card-link a:hover {
	color: #8FE6FF;
}

.loop-card-link a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}

@supports selector(:has(*)) {
	.loop-card:has(.loop-card-link a:focus-visible) {
		outline: 2px solid #35D0FF;
		outline-offset: 3px;
	}

	.loop-card-link a:focus-visible {
		outline: none;
	}
}

.loop-card-topic:empty,
.loop-card-text:empty {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.loop-card {
		transition: none;
	}
}

Elementor 4 loop questions

Does the Elementor 4 Collection loop need Elementor Pro?

Yes. Elementor's help article says the Atomic Loop architecture requires an active Elementor Pro licence.

Can the Collection loop show a JetEngine post type?

Yes. Set the query source to the post type. This site lists its JetEngine Experiments post type that way.

How do I make a whole card clickable?

Keep one real link and stretch its ::after over the card with position: absolute and inset: 0, with position: relative on the card.

Why not wrap the whole card in a link?

A screen reader would read every word of the card as the link name. A stretched link keeps the name short.

How do I hide an empty dynamic field?

Use :empty on its class, as in step 6. It only works if the element is completely empty.

Can I give each post its own colour?

Loop items carry no post classes, so use :has() on a link or value inside the card, as the status badges guide does.

Can the cards lift on hover?

Yes. A soft box-shadow on .loop-card:hover works well. Box Shadow Generator, made by Mark McNeece of 365i, builds one you can copy.

Sources

  1. Elementor: How to Use the Atomic Loop
  2. Heydon Pickering, Inclusive Components: Cards
  3. Adrian Roselli: Block Links, Cards, Clickable Regions, Rows, Etc.
  4. MDN Web Docs: :has()
  5. MDN Web Docs: :empty

More build guides

The latest guides, newest first.

Elementor

A clickable card grid with the Elementor 4 Collection loop

The Elementor 4 Collection loop repeats one design for every post a query finds. On this site it lists the build guides, which are a JetEngine post type, in the element gallery, the Lab and the mega menu, all from one card component. This guide builds that grid, makes each whole card clickable and hides fields that come back empty.

25 minutes Get the guide
Elementor

Style the Elementor 4 Carousel element: arrows, dots and loop

The Elementor 4 Carousel element gives you slides, arrows and dots as separate atomic parts. Out of the box on this site, the arrows sat on top of the slide titles, the active dot was black on a dark panel and Loop did nothing. This guide fixes all three, with the CSS the element gallery now runs.

20 minutes Get the guide
Elementor

The Elementor 4 Accordion element, built on native details

The Elementor 4 Accordion element is built on the browser's own details and summary elements, so it opens and closes with no script. This guide sets it up the way the element gallery on this site does, styles it with classes, and explains the FAQ schema switch and what Google now does with it.

15 minutes Get the guide