Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Expandable List | Text Boxes
Test UI Features
course content

Kursinnhold

Test UI Features

Test UI Features

1. Buttons
2. ContentDev Tools
3. Image Tools
4. Links
5. Other
7. Tables
8. Developers

book
Expandable List

Element

Source Code

html

index.html

copy

README

Expandable accordion component. It allows users to reveal or hide content inside collapsible sections.

How to Use the Component

Create the container for the accordion items.

html

Each accordion item consists of:

  • A hidden checkbox ( input[type="checkbox"] ): controls expansion;

  • A label ( label ): acts as the clickable trigger;

  • A content container ( div.content ): holds the expandable content.

Creating an Accordion Item

Each item must follow this structure:

html

Key points to remember:

  • The <input> must have a unique id ;

  • The <label> must have a matching for attribute that references the id of the checkbox;

  • The .content section contains the content that will be shown or hidden when the label is clicked.

Adding Content Inside an Accordion Item

If your content requires a list of items, use <ul> and <li> inside .content:

html

If your content is just text (not a list), use <p> inside .content:

html
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 6. Kapittel 10

Spør AI

expand
ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

course content

Kursinnhold

Test UI Features

Test UI Features

1. Buttons
2. ContentDev Tools
3. Image Tools
4. Links
5. Other
7. Tables
8. Developers

book
Expandable List

Element

Source Code

html

index.html

copy

README

Expandable accordion component. It allows users to reveal or hide content inside collapsible sections.

How to Use the Component

Create the container for the accordion items.

html

Each accordion item consists of:

  • A hidden checkbox ( input[type="checkbox"] ): controls expansion;

  • A label ( label ): acts as the clickable trigger;

  • A content container ( div.content ): holds the expandable content.

Creating an Accordion Item

Each item must follow this structure:

html

Key points to remember:

  • The <input> must have a unique id ;

  • The <label> must have a matching for attribute that references the id of the checkbox;

  • The .content section contains the content that will be shown or hidden when the label is clicked.

Adding Content Inside an Accordion Item

If your content requires a list of items, use <ul> and <li> inside .content:

html

If your content is just text (not a list), use <p> inside .content:

html
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 6. Kapittel 10
Vi beklager at noe gikk galt. Hva skjedde?
some-alt