How to Create an Image Accordion in Bricks Builder

Zawad Alam Avatar

Creating an image accordion in bricks builder

An image accordion shows several images side by side as narrow panels. When a visitor hovers over or focuses on a panel, it widens to reveal the full image and a short caption, while the others shrink. It fits a lot of visual content into one row and gives each item a moment of focus, which is why it is popular on portfolio, agency and travel sites.

Bricks Builder includes an Accordion element, but that element creates collapsible text sections with titles and expandable content, not image panels. This guide shows two ways to build a Bricks image accordion:

  • Method 1, no code: the BricksFly Image Accordion Element.
  • Method 2, CSS only: native Bricks Elements plus a short block of CSS, with keyboard support and a mobile layout.

You will also find use cases, an accessibility checklist, a dynamic version using a Bricks query loop, and fixes for common problems.

QUICK ANSWER

To create an image accordion in Bricks Builder without code, enable the BricksFly Image Accordion Element under BricksFly > Elements and add it to your page. To build one natively, place one Block per panel in a flex Container, give each Block an Image and a caption, and use CSS so the hovered or focused panel grows (flex-grow: 4) while the others stay narrow (flex-grow: 1).

What Is an Image Accordion?

Image accordion anatomy

Collapsed panels, one expanded panel and the content overlay

PartWhat it does
PanelsEach panel holds one image. Collapsed panels show a narrow slice of the image
Expanded panelThe active panel takes more width so the image and caption are fully visible
Content overlayA title, short text and optional link shown on the expanded panel, usually over a dark gradient for contrast
TriggerHover and keyboard focus on desktop; a tap, or a stacked layout, on phones

Compared with a slider, an image accordion shows every item at once, so visitors see how many items there are and can jump to any of them. Compared with a grid, it saves vertical space and gives one item visual priority.

When to Use an Image Accordion

Image accordion use cases

Six good uses for an image accordion

Use caseExample
Portfolio categoriesBranding, web design, photography, motion and print, each linking to a filtered portfolio
Services overviewOne panel per service with a short line and a link to the service page
Destinations or roomsTravel destinations, hotel rooms or venue spaces
Team or departmentsDepartment photos with the team name and a short description
Product collectionsSeasonal or category collections for a store
Case study teasersA key image, one result and a read-more link

Keep it to three to six panels. With more, the collapsed panels become slivers too thin to recognize, especially on laptops.

Method 1: Add an Image Accordion With BricksFly (No Code)

BricksFly is a complete Bricks Builder toolkit that helps users build modern animated websites faster with full website templates, 500+ sections, extra Elements, Extensions, and no-code GSAP animations. Its Image Accordion Element highlights images with smooth accordion-style interactions, and it sits in the Advanced Elements group of the BricksFly documentation.

Step 1: Enable the Image Accordion Element

  1. Go to your WordPress Dashboard and click BricksFly.
  2. Open the Elements tab.
  3. Select the Advanced category, toggle on Image Accordion, then click Save Settings.
Activate image accordion

Step 2: Add the Element to Your Page

Open the page in the Bricks editor. BricksFly Elements appear in the BricksFly group of the Elements panel.

Drag Image Accordion into a Section, then add your items, images and captions in the Element’s Content settings.

Three items are added

Step 3: Style It and Add Motion

  • Match the panel height to your layout; around 420 to 560 px works well for a full-width desktop row.
Image 14
  • Use images with the subject near the center, so the collapsed slices still show something recognizable.
Image 15
  • Adjust the Accordion Settings – Title HTML Tag, layout, Default Open Item and many more.
  • BricksFly Elements show panels for the BricksFly Extensions you have enabled. For example, use Advanced Animation to fade the whole accordion in on scroll.
  • Test on a phone and check how the Element behaves on small screens.

The full list of options is in the Image Accordion documentation.

Final Result

Prefer no code?

The Image Accordion Element is part of the BricksFly toolkit, along with 30+ starter templates, 500+ sections, and the GSAP animation engine.

See BricksFly Plans

Method 2: Build an Image Accordion With Native Bricks and CSS

This version uses only native Bricks Elements and about 50 lines of CSS. It works with hover, keyboard focus and touch, and stacks the panels on phones.

Step 1: Build the Structure

Image accordion structure

Container > Block > Image + content Div

  1. Add a Section, and give its Container the class img-acc.
  2. Inside the Container, add a Block for each panel and give it the class img-acc__item. Set the Block’s HTML tag to a link (a) and point it to the page the panel should open. This makes the whole panel clickable and focusable with the keyboard.
  3. Inside each Block, add an Image Element with descriptive alt text.
  4. Below the Image, add a Div with the class img-acc__content, and put a Heading and a short Text Element inside it.
  5. Duplicate the Block until you have three to six panels. Add the class is-default to the panel that should be open before any interaction.

Using a real Image Element instead of a CSS background image keeps alt text for screen readers, and Bricks applies native lazy loading to images by default.

Step 2: Add the CSS

Paste this into Bricks > Settings > Custom code > Custom CSS, or into the Container’s custom CSS:

.img-acc {

  display: flex;

  gap: 12px;

  height: 480px;

}

.img-acc__item {

  position: relative;

  flex: 1 1 0;

  min-width: 0;

  overflow: hidden;

  border-radius: 16px;

  transition: flex-grow .5s ease;

}

.img-acc__item img {

  position: absolute; inset: 0;

  width: 100%; height: 100%;

  object-fit: cover;

}

/* The open panel: default, hovered or keyboard-focused */

.img-acc__item.is-default,

.img-acc__item:hover,

.img-acc__item:focus-visible { flex-grow: 4; }

/* When another panel is active, close the default one */

.img-acc:hover .img-acc__item.is-default:not(:hover),

.img-acc:focus-within .img-acc__item.is-default:not(:focus-visible) { flex-grow: 1; }

.img-acc__content {

  position: absolute; left: 0; right: 0; bottom: 0;

  padding: 24px;

  color: #fff;

  background: linear-gradient(transparent, rgba(0, 0, 0, .7));

  opacity: 0;

  transform: translateY(12px);

  transition: opacity .3s ease, transform .3s ease;

}

.img-acc__item.is-default .img-acc__content,

.img-acc__item:hover .img-acc__content,

.img-acc__item:focus-visible .img-acc__content { opacity: 1; transform: none; }

.img-acc:hover .img-acc__item.is-default:not(:hover) .img-acc__content { opacity: 0; }

.img-acc__item:focus-visible { outline: 3px solid #fff; outline-offset: -6px; }

/* Phones: stacked panels with captions always visible */

@media (max-width: 767px) {

  .img-acc { flex-direction: column; height: auto; }

  .img-acc__item { flex: none; height: 200px; }

  .img-acc__content { opacity: 1; transform: none; }

}

@media (prefers-reduced-motion: reduce) {

  .img-acc__item, .img-acc__content { transition: none; }

}

How the CSS Works

  • Every panel starts with flex: 1 1 0, so all panels share the row equally.
  • The active panel gets flex-grow: 4, so it takes four shares of the free space while the others keep one.
  • min-width: 0 lets the panels shrink below the width of their content, which flex items do not do by default.
  • object-fit: cover keeps each image filling its panel without stretching as the width changes.
  • :focus-visible opens a panel when it is reached with the Tab key and shows a visible focus ring.
  • On phones the panels stack vertically with captions always visible, because there is no hover on touch screens.

Performance Note: Animating flex-grow changes the layout, which requires more work from the browser than animating transform or opacity. With three to six panels and optimized images, this is generally not a problem. However, avoid placing several large accordions on a single page.

Make It Dynamic With a Bricks Query Loop

To fill the accordion from posts, projects or a custom post type, use one Block instead of several:

  1. Keep a single Block with the class img-acc__item inside the img-acc Container.
  2. Enable Use query loop on the Block and choose your post type, for example Projects, with a limit of 5.
  3. Set the Image Element’s source to the featured image with dynamic data, and the Heading to the post title.
  4. Link the Block to the post URL with dynamic data.
  5. To open the first panel by default, add .img-acc__item:first-child to the rules that use .is-default.

Desktop, Keyboard and Mobile Behavior

Image accordion devices

Plan each device before styling

DeviceRecommended behavior
Desktop with mouseHover expands a panel; a click opens the linked page
KeyboardTab moves between panels; the focused panel expands with a visible focus ring
TabletTap expands or opens the link; test both portrait and landscape
PhoneStack panels vertically with captions always visible, or switch to a simple card list
Reduced motionPanels still change size, but without the transition

Accessibility and Speed Checklist

Image accordion checklist

Six checks before publishing

  • Use real Image Elements with descriptive alt text instead of CSS background images.
  • Make every panel reachable by keyboard through a link or button inside it.
  • Keep caption text readable. WCAG 2.2 Level AA asks for a contrast ratio of at least 4.5:1 for normal text, so place white text over a dark gradient, not directly on a bright photo.
  • Do not hide essential information inside collapsed panels. Prices or contact details belong elsewhere on the page.
  • Size images for the expanded width, not the full screen. An expanded panel in a 1,200px row is roughly 700px wide, so very large originals are wasted bandwidth.
  • Respect reduced motion with the media query in the CSS above.

Troubleshooting for Image Accordion

ProblemLikely causeFix
Panels do not shrinkContent inside sets a minimum widthAdd min-width: 0 to the panel
Images stretch or squashImage keeps its natural sizePosition the image absolutely with object-fit: cover
Captions overflow collapsed panelsText is visible on narrow panelsHide the content Div unless the panel is open
Keyboard users cannot open panelsPanels are not focusableMake each Block a link, or add a link inside it
Hover state sticks on phonesTouch devices emulate hover on tapUse the stacked mobile layout
Image Accordion Element missing in the editorElement not enabledEnable it in BricksFly > Elements > Advanced and save

Common Mistakes to Avoid When Creating an Image Accordion in Bricks Builder

An image accordion can make a website more interactive and visually engaging, but poor design choices can affect its usability, readability, and responsiveness. Avoid these common mistakes to create a smooth experience across desktop and mobile devices.

Adding Too Many Accordion Panels

Avoid adding too many panels to a single image accordion. More than six panels can make the collapsed sections too narrow, leaving users with very little visual information to identify each image. Keep the number of panels manageable so visitors can easily explore the available content.

Displaying Text in Collapsed Panels

Showing full captions or descriptions inside collapsed panels can make the accordion look cluttered. Instead, display captions and supporting text only when a panel is expanded. This keeps the layout clean and gives the selected image enough space to communicate its message.

Choosing Images with Off-Center Subjects

Images with subjects positioned near the edges may not look good when displayed in narrow, collapsed panels. The important part of the image might get cropped, leaving only background details visible. Choose images with centrally positioned subjects or use appropriate image positioning settings to keep the main subject visible.

Ignoring the Mobile Layout

A horizontal accordion with several narrow image slices may look attractive on desktop but become difficult to use on smaller screens. Plan a separate mobile layout by reducing the number of visible panels, adjusting their dimensions, or switching to a vertical accordion arrangement. Always test the interaction on actual mobile screen sizes.

Forgetting Alt Text for Background Images

When images are used as backgrounds, their visual content may not be accessible to screen reader users by default. Provide meaningful alternative text through an appropriate accessible text or image element when the image communicates important information. Decorative images, on the other hand, should not add unnecessary descriptions.

Using Slow or Excessive Transitions

Long transitions can make the accordion feel sluggish and delay interactions. Keep the width transition around 0.5 seconds to create a responsive expansion effect. Avoid unnecessary animation effects that distract visitors or make the interaction feel slow.

Final Tip: Keep your image accordion simple, responsive, and accessible. A well-planned layout with carefully selected images and smooth transitions will provide a better experience for visitors on every device.

How BricksFly Helps

BricksFly gives you the Image Accordion Element for the no-code route, and the rest of the toolkit around it: starter templates with ready layouts, sections from the Bricks section library, more BricksFly Elements, and the GSAP animation engine to animate the section around the accordion. For a related hover effect, see image reveal on hover, which shows an image when visitors hover over a text link.

Build Interactive Bricks Pages Faster

Get the Image Accordion Element and the full BricksFly toolkit: 30+ starter templates, 500+ sections, extra Elements, Extensions, and the no-code GSAP animation engine.

Black Friday Sale – Until December 10, 2026. Get up to 50% off yearly and lifetime plans!

Get BricksFly Pro

Conclusion

A Bricks image accordion turns a handful of images into a compact, interactive row where each item gets its moment. Use the BricksFly Image Accordion Element when you want to set it up without code, or build it natively with a flex Container, one Block per panel and about 50 lines of CSS.

Whichever method you choose, keep it to three to six panels, use real images with alt text, support keyboard focus, stack the panels on phones, and respect reduced motion.

FAQs

Does Bricks Builder have an image accordion element?

Bricks includes an Accordion element, but it creates collapsible text sections with titles and content, not expanding image panels. For an image accordion, use an add-on Element such as the BricksFly Image Accordion, or build one from native Blocks and Images with a short block of CSS.

How do I make an image accordion without a plugin?

Place one Block per panel inside a flex Container, add an Image and a caption Div to each Block, and use CSS so the hovered or focused panel gets flex-grow: 4 while the others keep flex-grow: 1. Add a mobile media query that stacks the panels, and a reduced-motion rule that removes the transition.

Should the accordion open on hover or click?

On desktop, hover gives a quick preview and a click opens the linked page. Keyboard users need focus support, which :focus-visible provides. On touch screens there is no hover, so a stacked layout with visible captions is usually clearer than relying on taps.

How many panels should an image accordion have?

Three to six panels work best. With more, the collapsed panels become too narrow to recognize on laptops, and the expanded panel has less room. If you have more items, use a grid or a slider, or split them into two accordions.

Can I fill an image accordion with posts or projects?

Yes. In the CSS method, enable the Bricks query loop on a single Block, then use dynamic data for the featured image, the post title and the post URL. The CSS applies to every Block the loop outputs.

Is an image accordion good for mobile?

Not in its desktop form. A row of narrow panels is hard to use on a small screen. Stack the panels vertically on phones with captions always visible, or switch to a simple list of cards at the mobile breakpoint.

Share

Zawad Alam Avatar

Written by

Leave a Reply