From the course: Modern CSS Techniques without JavaScript
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Creating an accordion that's initially open
From the course: Modern CSS Techniques without JavaScript
Creating an accordion that's initially open
- [Instructor] In our previous video, I gave you the starting text for this particular CodePen and asked you to mark it up with details and summary elements. So, here is the way that I went about doing that. Just before Sustainable Landscaping, I started my details element. I put the summary tags around the words Sustainable Landscaping, And then I have a paragraph of information, followed by /details. And that pattern continues for the other two items. So, my details tag starts on line eight, it ends on line 11. In between, we have Planting Plans inside of the summary tags, and then, finally, down on line 12, we start details, we end that on line 15, and we have our summary tags around Water Features and Garden Structures. The result is a page that looks like this where I have three possible accordion items. And a few things to notice about this, first of all, none of them are open by default. That's what I'm going to show you in just a moment. The second part is, of course, that I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Introducing <details> and <summary>3m 38s
-
(Locked)
Creating an accordion that's initially open2m 47s
-
(Locked)
Creating an integrated series of accordions using the name attribute2m 10s
-
(Locked)
Styling the accordions6m 41s
-
(Locked)
Changing the arrow with ::marker4m
-
(Locked)
Challenge: Changing the ::marker between open and closed states1m 24s
-
(Locked)
Solution: Changing the ::marker between open and closed states2m 25s
-
(Locked)
Animating the marker7m 56s
-
(Locked)
Animating the details panel7m 3s
-
-
-
-
-