Site logo

Archived topic

How do I add an accordion to Generate Sections?

25 replies · Started by Alan on July 19, 2021

Viewing posts 16–26 of 26

Hi Elvin

Its on the bottom of the ceiling fans page

Hi Elvin

I may have almost sorted it out. I found a way to do it using css and html alone. No Javascript at all.

Gold Coast Ceiling Fan Installations

I found the code here

Accordion

Are you able to tell me how to make the 3rd dropdown list background appear the lighter colour behind the bullets when its open? I cant work that out. I added this but its not quite right.

ul.details {
    background: #fbfbfb;
    line-height:30px;
    list-style: disc;    
    font-size:1.7rem;
    font-size:17px;
    font-style: italic;
    padding: 1.5rem 1rem;

}

Hi there,

try this:

ul.details {
    background: #fbfbfb;
    line-height: 30px;
    list-style: disc;
    font-size: 1.7rem;
    font-size: 17px;
    font-style: italic;
    margin-left: 0;
    padding: 1.5rem 2.5rem;
}

Thanks David.

I will give that a try.

In your opinion is this version of an accordion that doesn’t include any JavaScript better than one that does include JavaScript?

Is it more lightweight and are there negative implications in doing it this way?

Thanks,

Alan

using the <details> HTML Element is the most performant way of adding accordions. Its browser native, and requires no JS to be loaded.

Thanks David.

That’s what I was hoping!

Glad we could be of help.

Looks great!

Thanks again for the help !

This archived topic is closed to new replies.