Test365i
365i.co.uk
Back to all guides
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.

e-accordion
Is this a native details element?

Yes. Each item is a details and summary pair, so it opens and closes with no JavaScript at all.

Can it hold any element?

The content slot accepts any atomic element, including images and buttons.

Does it work with a keyboard?

It does, because the browser provides the behaviour for summary elements.

15 minutesElementor

Works on WordPress 7.2, Elementor 4.4.2; native details and summary in every current browser

Editorial integrity: read our editorial standards.

  1. Add the Accordion element and set how it opens

    Drag in the Accordion element. Each item has a header (the question) and a content slot that takes any Elementor 4 element. In the settings, choose Default state (this site uses first item open), Max expanded (one) and whether to show the icon.

    Elementor prints each item as a <details> element. With Max expanded set to one, every item gets the same name attribute (on this site, name="d68a65e" on all three), and the browser itself closes the others when one opens. The accordion at the top of this guide is the real Elementor 4 element with these settings: open a second question and the first one closes. The HTML below is the same pattern by hand.

    Three details elements sharing one name attribute; the first is open and shows its answer
    Elementor gives every item the same name when only one may be open.
    index.htmlHTML
    <div class="faq">
    	<details class="faq-item" name="faq" open>
    		<summary class="faq-q">Is this a native details element?<span class="faq-icon" aria-hidden="true"></span></summary>
    		<div class="faq-a">Yes. It opens and closes with no JavaScript.</div>
    	</details>
    	<details class="faq-item" name="faq">
    		<summary class="faq-q">Can it hold any element?<span class="faq-icon" aria-hidden="true"></span></summary>
    		<div class="faq-a">The content slot accepts any atomic element.</div>
    	</details>
    	<details class="faq-item" name="faq">
    		<summary class="faq-q">Does it work with a keyboard?<span class="faq-icon" aria-hidden="true"></span></summary>
    		<div class="faq-a">Yes. The browser provides the behaviour for summary elements.</div>
    	</details>
    </div>
    After step 1, unstyled: open one question and the open one closes, with no script at all.

    Scott O'Hara, who has written about disclosure widgets in detail, makes the point that matters most here:

    These native disclosure widgets function without JavaScript, unless you need to support legacy browsers.

    Scott O'Hara, "The details and summary elements, again"

    That is why the unstyled preview above already works. Elementor does not have to load anything for the accordion to open, close or be reached with a keyboard, which makes it one of the lightest interactive elements you can put on a page.

  2. Style the items

    Give each item the class faq-item and the content the class faq-a. On this site the items carry the shared lab-glass class from the Test365i design system, which is the same idea.

    accordion.cssCSS
    .faq {
    	display: grid;
    	gap: 10px;
    	max-width: 460px;
    }
    
    .faq-item {
    	border-radius: 14px;
    	border: 1px solid rgba(255, 255, 255, 0.12);
    	background-color: rgba(255, 255, 255, 0.05);
    }
    
    .faq-a {
    	padding: 0 18px 18px;
    	color: #BBBBD1;
    	line-height: 1.6;
    }
    After step 2: each item is a soft glass card.
  3. Lay out the question row

    The header (<summary>) becomes a flex row with the question on the left and the icon on the right. list-style: none and the ::-webkit-details-marker rule remove the browser's own triangle, because the icon replaces it.

    accordion.cssCSS
    .faq-q {
    	display: flex;
    	justify-content: space-between;
    	align-items: center;
    	gap: 12px;
    	padding: 16px 18px;
    	font-weight: 600;
    	color: #F6F6FC;
    	cursor: pointer;
    	list-style: none;
    }
    
    .faq-q::-webkit-details-marker {
    	display: none;
    }
    After step 3: the question and the icon space share one row, and the default triangle is gone.
  4. Turn the icon when an item opens

    details gains an open attribute when it opens, so .faq-item[open] is all the state you need. In Elementor 4 the icon rotation is a setting; this is the same effect in CSS, with a violet border on the open item.

    accordion.cssCSS
    .faq-icon {
    	flex: none;
    	width: 9px;
    	height: 9px;
    	border-right: 2px solid #8F90A7;
    	border-bottom: 2px solid #8F90A7;
    	transform: rotate(45deg);
    	transition: transform 0.2s;
    }
    
    .faq-item[open] .faq-icon {
    	transform: rotate(-135deg);
    }
    
    .faq-item[open] {
    	border-color: rgba(116, 83, 254, 0.45);
    }
    After step 4: the chevron turns over and the border lights up on the open item.
  5. Keep it accessible, and decide on FAQ schema

    A visible focus ring shows keyboard users which question they are on, and the reduced-motion rule stops the icon animating for people who ask for less motion.

    The Accordion element also has an FAQ schema switch, which prints an FAQPage block of structured data built from each question and answer. Turn it on only when the accordion really is a list of questions and answers. The guides on this site carry their own FAQPage data for the same reason.

    accordion.cssCSS
    .faq-q:focus-visible {
    	outline: 2px solid #35D0FF;
    	outline-offset: 3px;
    	border-radius: 12px;
    }
    
    @media (prefers-reduced-motion: reduce) {
    	.faq-icon { transition: none; }
    }
    After step 5: click in the preview and press Tab. The focus ring shows which question you are on.

    Google's own changelog records what changed for FAQ markup in search:

    This feature will no longer appear in Google Search starting May 7, 2026.

    Google Search Central, Latest documentation updates

    That entry is about the FAQ rich result, the expandable questions under a search listing. FAQPage is still valid structured data that describes the page, so the switch is not harmful, but it will not win you extra space in Google any more. Use it for accuracy, not for a rich result.

What the accordion element does not do

Closed content is collapsed by the browser, so put anything every visitor must read outside the accordion.

It does not animate the opening height in this setup; the content appears at once.

The FAQ schema switch no longer produces an FAQ rich result in Google Search, since 7 May 2026.

All the code for this accordion

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

index.htmlHTML
<div class="faq">
	<details class="faq-item" name="faq" open>
		<summary class="faq-q">Is this a native details element?<span class="faq-icon" aria-hidden="true"></span></summary>
		<div class="faq-a">Yes. It opens and closes with no JavaScript.</div>
	</details>
	<details class="faq-item" name="faq">
		<summary class="faq-q">Can it hold any element?<span class="faq-icon" aria-hidden="true"></span></summary>
		<div class="faq-a">The content slot accepts any atomic element.</div>
	</details>
	<details class="faq-item" name="faq">
		<summary class="faq-q">Does it work with a keyboard?<span class="faq-icon" aria-hidden="true"></span></summary>
		<div class="faq-a">Yes. The browser provides the behaviour for summary elements.</div>
	</details>
</div>
accordion.cssCSS
.faq {
	display: grid;
	gap: 10px;
	max-width: 460px;
}

.faq-item {
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background-color: rgba(255, 255, 255, 0.05);
}

.faq-a {
	padding: 0 18px 18px;
	color: #BBBBD1;
	line-height: 1.6;
}

.faq-q {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	font-weight: 600;
	color: #F6F6FC;
	cursor: pointer;
	list-style: none;
}

.faq-q::-webkit-details-marker {
	display: none;
}

.faq-icon {
	flex: none;
	width: 9px;
	height: 9px;
	border-right: 2px solid #8F90A7;
	border-bottom: 2px solid #8F90A7;
	transform: rotate(45deg);
	transition: transform 0.2s;
}

.faq-item[open] .faq-icon {
	transform: rotate(-135deg);
}

.faq-item[open] {
	border-color: rgba(116, 83, 254, 0.45);
}

.faq-q:focus-visible {
	outline: 2px solid #35D0FF;
	outline-offset: 3px;
	border-radius: 12px;
}

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

Elementor 4 accordion questions

Does the Elementor 4 Accordion need JavaScript?

No. It is built on details and summary, which the browser opens and closes itself.

How do I allow only one item open at a time?

Set Max expanded to one. Elementor gives every item the same name attribute and the browser closes the others.

Can an accordion item hold other elements?

Yes. The content slot accepts any Elementor 4 atomic element, including images and buttons.

Is the accordion accessible with a keyboard?

Yes. Summary elements can be reached with Tab and opened with Enter or Space without any extra code.

Should I turn on FAQ schema?

Only for genuine questions and answers. It still describes the page, but Google stopped showing FAQ rich results on 7 May 2026.

How do I hide the default triangle?

Set list-style: none on the summary and hide ::-webkit-details-marker, as in step 3.

Can the open item glow?

Yes. A soft coloured box-shadow on .faq-item[open] lifts it. Box Shadow Generator, made by Mark McNeece of 365i, builds one you can copy.

Sources

  1. Scott O'Hara: The details and summary elements, again
  2. MDN Web Docs: details element
  3. Google Search Central: Latest documentation updates
  4. Elementor: How to use the Accordion element in the Atomic editor

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