Màu viền đàn accordion Bootstrap

Lorem ipsum dolor sit amet, consectetur adipisizing elit, sed do eiusmod tempor incididunt utlabore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercite ullamcolaboris nisi ut aliquip ex ea commodo do đó

Phần 2

Lorem ipsum dolor sit amet, consectetur adipisizing elit, sed do eiusmod tempor incididunt utlabore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercite ullamcolaboris nisi ut aliquip ex ea commodo do đó

Phần 3

Lorem ipsum dolor sit amet, consectetur adipisizing elit, sed do eiusmod tempor incididunt utlabore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercite ullamcolaboris nisi ut aliquip ex ea commodo do đó

Tự mình thử »


Tạo một chiếc đàn accordion

Bước 1) Thêm HTML

Thí dụ

Phần 1

Lorem ipsum


Phần 2

Lorem ipsum


Phần 3

Lorem ipsum



Bước 2) Thêm CSS

Phong cách đàn accordion

Thí dụ

/* Tạo kiểu cho các nút dùng để mở và đóng bảng đàn accordion */
. đàn accordion {
  màu nền. #eee;
  màu. #444;
  con trỏ. con trỏ;
  phần đệm. 18px;
  chiều rộng. 100%;
  căn chỉnh văn bản. trái;
  đường viền. không;
  đường viền. không;
  chuyển tiếp. 0. 4s;
}

/* Thêm màu nền cho nút nếu nó được nhấp vào (thêm. lớp đang hoạt động với JS) và khi bạn di chuột qua nó (hover) */
. tích cực,. đàn phong cầm. di chuột {
  màu nền. #ccc;
}

/* Tạo kiểu cho bảng đàn accordion. Ghi chú. ẩn theo mặc định */
. bảng điều khiển {
  phần đệm. 0 18px;
  màu nền. màu trắng;
  hiển thị. không;
  tràn. ẩn;
}



Bước 3) Thêm JavaScript

Thí dụ

var acc = tài liệu. getElementsByClassName("accordion");
var i;

cho (i = 0; i < acc. chiều dài; . addEventListener("click", function() {
  acc[i].addEventListener("click", function() {
    /* Chuyển đổi giữa việc thêm và xóa lớp "hoạt động",
    để đánh dấu nút điều khiển bảng điều khiển * . danh sách lớp học. chuyển đổi ("hoạt động");
    this.classList.toggle("active");

    /* Chuyển đổi giữa ẩn và hiển thị bảng điều khiển đang hoạt động */
    var panel = this. nextElementSibling;
    if (panel. Phong cách. hiển thị === "chặn") {
      bảng điều khiển. Phong cách. display = "none";
    } other {
      bảng điều khiển. Phong cách. display = "block";
    }
  });
}

Tự mình thử »


Đàn accordion hoạt hình (Trượt xuống)

Để tạo một chiếc đàn accordion hoạt hình, hãy thêm

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

0,

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

1 và

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

2 cho thuộc tính chiều cao tối đa, vào lớp

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

3

Sau đó, sử dụng JavaScript để trượt nội dung xuống bằng cách đặt

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

4 được tính toán, tùy thuộc vào chiều cao của bảng điều khiển trên các kích thước màn hình khác nhau

Đàn accordion sử dụng sự sụp đổ bên trong để làm cho nó có thể thu gọn lại. Để hiển thị đàn accordion được mở rộng, hãy thêm lớp

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

5 vào lớp

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

6

Thí dụ

Nhấp vào đàn accordion bên dưới để mở rộng/thu gọn nội dung đàn accordion

Đây là thân đàn accordion của mặt hàng đầu tiên. Nó được hiển thị theo mặc định, cho đến khi plugin thu gọn thêm các lớp thích hợp mà chúng tôi sử dụng để tạo kiểu cho từng thành phần. Các lớp này kiểm soát giao diện tổng thể, cũng như hiển thị và ẩn thông qua chuyển tiếp CSS. Bạn có thể sửa đổi bất kỳ điều nào trong số này bằng CSS tùy chỉnh hoặc ghi đè các biến mặc định của chúng tôi. Cũng cần lưu ý rằng gần như bất kỳ HTML nào cũng có thể xuất hiện trong

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

7, mặc dù quá trình chuyển đổi hạn chế tình trạng tràn

Đây là thân đàn accordion của vật phẩm thứ hai. Nó được ẩn theo mặc định, cho đến khi plugin thu gọn thêm các lớp thích hợp mà chúng tôi sử dụng để tạo kiểu cho từng phần tử. Các lớp này kiểm soát giao diện tổng thể, cũng như hiển thị và ẩn thông qua chuyển tiếp CSS. Bạn có thể sửa đổi bất kỳ điều nào trong số này bằng CSS tùy chỉnh hoặc ghi đè các biến mặc định của chúng tôi. Cũng cần lưu ý rằng gần như bất kỳ HTML nào cũng có thể xuất hiện trong

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

7, mặc dù quá trình chuyển đổi hạn chế tình trạng tràn

Đây là thân đàn accordion của vật phẩm thứ ba. Nó được ẩn theo mặc định, cho đến khi plugin thu gọn thêm các lớp thích hợp mà chúng tôi sử dụng để tạo kiểu cho từng phần tử. Các lớp này kiểm soát giao diện tổng thể, cũng như hiển thị và ẩn thông qua chuyển tiếp CSS. Bạn có thể sửa đổi bất kỳ điều nào trong số này bằng CSS tùy chỉnh hoặc ghi đè các biến mặc định của chúng tôi. Cũng cần lưu ý rằng gần như bất kỳ HTML nào cũng có thể xuất hiện trong

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

7, mặc dù quá trình chuyển đổi hạn chế tình trạng tràn

Accordion Item #1

This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

Accordion Item #2

This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

Accordion Item #3

This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

Tuôn ra

Thêm

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

0 để xóa

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

1 mặc định, một số đường viền và một số góc được làm tròn để hiển thị các đàn accordion từ cạnh này sang cạnh khác với vùng chứa chính của chúng

Nội dung trình giữ chỗ cho đàn accordion này, nhằm thể hiện lớp

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

0. Đây là thân đàn accordion của mặt hàng đầu tiên

Nội dung trình giữ chỗ cho đàn accordion này, nhằm thể hiện lớp

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

0. Đây là thân đàn accordion của vật phẩm thứ hai. Hãy tưởng tượng điều này chứa đầy một số nội dung thực tế

Nội dung trình giữ chỗ cho đàn accordion này, nhằm thể hiện lớp

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

0. Đây là thân đàn accordion của vật phẩm thứ ba. Không có gì thú vị hơn xảy ra ở đây về mặt nội dung, nhưng chỉ cần lấp đầy khoảng trống để làm cho nó, ít nhất là ở cái nhìn đầu tiên, đại diện hơn một chút về cách thức này sẽ trông như thế nào trong một ứng dụng trong thế giới thực

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

Luôn luôn mở

Bỏ qua thuộc tính

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

5 trên mỗi

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

6 để làm cho các mục đàn accordion luôn mở khi một mục khác được mở

Đây là thân đàn accordion của mặt hàng đầu tiên. Nó được hiển thị theo mặc định, cho đến khi plugin thu gọn thêm các lớp thích hợp mà chúng tôi sử dụng để tạo kiểu cho từng thành phần. Các lớp này kiểm soát giao diện tổng thể, cũng như hiển thị và ẩn thông qua chuyển tiếp CSS. Bạn có thể sửa đổi bất kỳ điều nào trong số này bằng CSS tùy chỉnh hoặc ghi đè các biến mặc định của chúng tôi. Cũng cần lưu ý rằng gần như bất kỳ HTML nào cũng có thể xuất hiện trong

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

7, mặc dù quá trình chuyển đổi hạn chế tình trạng tràn

Đây là thân đàn accordion của vật phẩm thứ hai. Nó được ẩn theo mặc định, cho đến khi plugin thu gọn thêm các lớp thích hợp mà chúng tôi sử dụng để tạo kiểu cho từng phần tử. Các lớp này kiểm soát giao diện tổng thể, cũng như hiển thị và ẩn thông qua chuyển tiếp CSS. Bạn có thể sửa đổi bất kỳ điều nào trong số này bằng CSS tùy chỉnh hoặc ghi đè các biến mặc định của chúng tôi. Cũng cần lưu ý rằng gần như bất kỳ HTML nào cũng có thể xuất hiện trong

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

7, mặc dù quá trình chuyển đổi hạn chế tình trạng tràn

Đây là thân đàn accordion của vật phẩm thứ ba. Nó được ẩn theo mặc định, cho đến khi plugin thu gọn thêm các lớp thích hợp mà chúng tôi sử dụng để tạo kiểu cho từng phần tử. Các lớp này kiểm soát giao diện tổng thể, cũng như hiển thị và ẩn thông qua chuyển tiếp CSS. Bạn có thể sửa đổi bất kỳ điều nào trong số này bằng CSS tùy chỉnh hoặc ghi đè các biến mặc định của chúng tôi. Cũng cần lưu ý rằng gần như bất kỳ HTML nào cũng có thể xuất hiện trong

Accordion Item #1

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.

Accordion Item #2

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.

Accordion Item #3

Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.

7, mặc dù quá trình chuyển đổi hạn chế tình trạng tràn

Accordion Item #1

This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

Accordion Item #2

This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

Accordion Item #3

This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

khả năng tiếp cận

Vui lòng đọc phần trợ năng thu gọn để biết thêm thông tin

tùy chỉnh

biến CSS

Accordions sử dụng các biến CSS cục bộ trên. đàn accordion để tăng cường tùy chỉnh thời gian thực. Các giá trị cho các biến CSS được đặt thông qua Sass, do đó tùy chỉnh Sass cũng vẫn được hỗ trợ