Bootstrap 5 手风琴在展开时变得太宽
P粉163465905
P粉163465905 2023-09-08 12:34:40
0
1
519

我原本期望手风琴组件能够展开以匹配其父元素的宽度,但是当它展开时,它不仅会扩展自身,还会扩展父元素,导致左窗格压缩很多。需要做什么才能实现期望的行为?我很感激任何答案。

  

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.
tab2 content

我尝试稍微调整一下手风琴标题的宽度及其内容,但这没有用。

P粉163465905
P粉163465905

全部回复 (1)
P粉536909186

#right-pane元素没有显式声明flex-basiswidth,因此它将占用所需的空间。当手风琴关闭时,它会按照您的预期工作,因为它的内容宽度较窄(然后由于flex-grow 中的flex-grow: 1,然后会增长以填充剩余空间-1类)。但是,当显示手风琴的内容时,内容将尝试占用尽可能多的水平空间。

为避免这种情况,请考虑在#right-pane元素上设置某种flex-basiswidth,例如width :25%通过w-25`此处:

  

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.
tab2 content
    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责声明 Sitemap
    PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!