Tutorial: Edit CSS accordion code for FAQ’s

In this tutorial, I’ll show you how to edit and customize the FAQ accordion in Showit using the Willawood website template. This accordion makes it easy to display frequently asked questions without having to build multiple canvases that show and hide when someone clicks. Everything is contained in one layout, and it’s quite simple to edit!

Step 1: Open the FAQ Accordion in Showit

First, open your website template inside the Showit builder. You’ll see your mobile view on the left and desktop view on the right. It doesn’t matter which one you edit because changes to the accordion code will apply to both.

The FAQ accordion is built using an Embed Code element inside a single canvas. To edit it:

  1. Find the canvas containing your FAQ accordion.
  2. Locate the Embed Code element.
  3. Double-click the element to open the code editor.

This is where you’ll make all your changes.

Step 2: Edit Your Questions and Answers

The first thing you’ll probably want to do is change the questions and answers to match your business. Inside the code editor, you’ll notice that the text you need to edit appears in white, while the other code elements appear in different colors. This makes it easier to identify what needs changing. Each question has its own section, followed by the answer.

  1. Find the question you want to change.
  2. Highlight the existing question text and replace it with your own.
  3. Find the answer directly below that question.
  4. Replace the existing answer with your own text.
  5. Click Save.

You’ll now see your updated question and answer in the accordion. The template comes with eight questions ready for you to customize. You’ll also notice that the questions are numbered. You don’t have to keep these numbers, but they make it easier to identify each question while editing.

Step 3: Add More FAQ Questions

Let’s say you have more than eight questions you’d like to include. You can easily add another question by duplicating an existing section of code. Inside the code editor, you’ll notice that certain elements repeat for each question.

You’ll also see a section labeled divider. This controls the dividing line between your questions. To add another question:

  1. Open the accordion’s Embed Code element.
  2. Find an existing question and its corresponding answer.
  3. Select and copy the complete code section for that question and answer, from its opening button tag through its closing </div> tag.
  4. Paste the copied code below the existing questions, keeping the divider structure consistent.
  5. Change the question number if you’re using numbered questions.
  6. Replace the question and answer text with your new content.
  7. Click Save.

Your new question should now appear at the bottom of the accordion.

A quick tip: If you’re adding quite a few questions, you may need to increase the height of your canvas to accommodate the additional content. You can adjust the canvas height under the Canvas tab in Showit. You may also need to click and drag the Embed Code element to make it taller. Make sure to check both your desktop and mobile layouts.

Step 4: Remove FAQ Questions

What if you don’t need all eight questions? Let’s say you only have five questions you’d like to include. You can remove the extra questions directly from the code.

  1. Double-click the Embed Code element to open the editor.
  2. Find the last question you want to keep.
  3. Locate the divider immediately after that question.
  4. Delete the excess question-and-answer sections below it, keeping the necessary closing code intact.
  5. Click Save.

Your accordion will now display only the questions you’ve kept. You can also adjust the canvas and Embed Code element heights if there’s too much empty space underneath.

Step 5: Customize the Fonts

Now that you’ve updated your questions and answers, let’s look at how you can customize the styling. If you scroll toward the bottom of the embed code, you’ll see notes explaining which styles you can change. The CSS accordion currently uses DM Sans, which is a free Google font. You can leave that as it is, but if you’d like to change it to match your brand, here’s how.

Find Your Font in Google Fonts

  1. Open  ⁠Google Fonts.
  2. Search for the font you’d like to use. For example, Montserrat.
  3. Click Get font.
  4. Select Get embed code.
  5. Find and copy the font stylesheet URL.

Update the Font in Showit

Head back to your accordion’s Embed Code element.

  1. Find the existing Google Fonts URL in the code.
  2. Replace it with your new font URL.
  3. Find the CSS font-family declarations using DM Sans.
  4. Replace DM Sans with the name of your new font in both places.
  5. Click Save.

Your accordion should now display your new font.

A quick tip: If you’re selecting fonts in Google Fonts, it’s easier to have only the font you’re using in your selection so you don’t accidentally copy a URL containing multiple fonts.

Step 6: Customize the Font Size, Colors, and Alignment

There are a few other styling options you can customize inside the code. Scroll down to the styling section, where you’ll see the CSS properties for your questions and answers.

Font Size: Look for font-size.

You can adjust the pixel value to make your text larger or smaller. For example, changing the value to 21px will make the text larger.

Font Color: Look for color.

You can replace the existing color value with your brand’s color.

Text Alignment: Look for text-align.

The accordion is currently aligned to the left, which is pretty standard for FAQs. But you can also change it to center or right if you’d prefer.

Background Color: Look for background-color.

You can change this to customize the background of your accordion.

Answer Styling: You’ll also find a separate styling section for the answers.

Here, you can adjust things like:

  • Font size
  • Line height
  • Font color
  • Background color

There are other settings inside the code, but I wouldn’t worry about changing those unless you’re comfortable working with CSS.

Step 7: Save and Preview Your Changes

Once you’ve finished customizing your accordion, click Save. You’ll see your updated questions, answers, fonts, and styling inside the Showit builder. Take a look at both your desktop and mobile layouts to make sure everything looks the way you want.

And that’s it! You’ve customized your FAQ accordion to match your website and brand. I hope this gives you a good idea of how to edit the accordion and make it your own.

If you’re looking for a fresh new website, be sure to check out the website templates in my shop.


Got Questions?

If you have any questions, don’t hesitate to reach out. You can email me at carrie@thecreativeaccent.com


More Tutorials You Might Like