Bootstrap màu đàn accordion

Nếu bạn mở các công cụ dành cho nhà phát triển của trình duyệt, bạn có thể thấy kiểu dáng của nút đàn accordion khi nó mở và đóng. Khi mở, các lớp/quy tắc sau được đặt

.accordion-item:first-of-type .accordion-button {
    border-top-left-radius: calc(0.25rem - 1px);
    border-top-right-radius: calc(0.25rem - 1px);
}
.accordion-button:not(.collapsed) {
    color: #0c63e4;
    background-color: #e7f1ff;
    box-shadow: inset 0 -1px 0 rgb(0 0 0 / 13%);
}

Bây giờ bạn đã sẵn sàng sửa đổi hành vi mặc định

Tôi đã đặt các kiểu sau trong các kiểu css trong công cụ dành cho nhà phát triển để có được những gì bạn muốn

.accordion-button:not(.collapsed) {
    color: #0c63e4;
    background-color: #fff;
    box-shadow: inset 0 -1px 0 rgb(0 0 0 / 13%);
    border-left: 2em solid red;
}

Bạn có thể xem bản xem trước trực tiếp về những thay đổi đã thực hiện

Vui thích

Thêm giải pháp của bạn ở đây

 B   I   U   S  small BIG code var  <   >   &  link [^] encode untab case indent outdent

Xem trước 0

thành viên hiện có

hoặc tham gia với chúng tôi

Tải xuống, Bình chọn, Nhận xét, Xuất bản

Email của bạn

Email này đang được sử dụng. Bạn có cần mật khẩu của bạn?

Mật khẩu tùy chọn

Khi trả lời một câu hỏi xin vui lòng

  1. Đọc kỹ câu hỏi
  2. Hiểu rằng tiếng Anh không phải là ngôn ngữ đầu tiên của mọi người, vì vậy hãy khoan dung với lỗi chính tả và ngữ pháp
  3. Nếu một câu hỏi được diễn đạt kém thì hãy yêu cầu làm rõ, bỏ qua nó hoặc chỉnh sửa câu hỏi và khắc phục sự cố. Xúc phạm không được chào đón
  4. Đừng bảo ai đó đọc hướng dẫn. Rất có thể họ có và không nhận được. Đưa ra câu trả lời hoặc chuyển sang câu hỏi tiếp theo
Hãy làm việc để giúp các nhà phát triển, không làm họ cảm thấy ngu ngốc


Nội dung này, cùng với bất kỳ tệp và mã nguồn liên quan nào, được cấp phép theo Giấy phép Mở Dự án Code (CPOL)

Đà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 .open vào .accordion

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 hầu như bất kỳ HTML nào cũng có thể xuất hiện trong .accordion-body, mặc dù quá trình chuyển đổi hạn chế 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 hầu như bất kỳ HTML nào cũng có thể xuất hiện trong .accordion-body, mặc dù quá trình chuyển đổi hạn chế 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 hầu như bất kỳ HTML nào cũng có thể xuất hiện trong .accordion-body, mặc dù quá trình chuyển đổi hạn chế 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 tròn để hiển thị các đàn accordions 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 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 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 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 hầu như bất kỳ HTML nào cũng có thể xuất hiện trong .accordion-body, mặc dù quá trình chuyển đổi hạn chế 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 hầu như bất kỳ HTML nào cũng có thể xuất hiện trong .accordion-body, mặc dù quá trình chuyển đổi hạn chế 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 hầu như bất kỳ HTML nào cũng có thể xuất hiện trong .accordion-body, mặc dù quá trình chuyển đổi hạn chế 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 để 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ợ

Làm cách nào để đặt đàn accordion trong Bootstrap?

Đàn xếp sử dụng tính năng thu gọn 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. mở lớp trên. đàn xếp . Hiệu ứng hoạt hình của thành phần này phụ thuộc vào truy vấn phương tiện chuyển động giảm ưu tiên. Xem phần giảm chuyển động trong tài liệu trợ năng của chúng tôi.

Bootstrap có đàn accordion không?

Đàn xếp Bootstrap là một thành phần tổ chức nội dung trong các mục có thể thu gọn . Accordion cho phép hiển thị chỉ một mục thu gọn tại một thời điểm.

Làm cách nào để sử dụng đàn accordion Bootstrap trong Angular?

Thành phần góc Bootstrap 5 Accordion .
Ví dụ cơ bản. Nhấp vào đàn accordion bên dưới để mở rộng/thu gọn nội dung đàn accordion. .
Tuôn ra. Sử dụng đầu vào [flush]="true" để xóa màu nền 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 cạnh của đàn accordion với vùng chứa chính của chúng. .
không biên giới. .
Luôn luôn mở