Bootstrap-vue: Scroll body of modal with fixed header?

Created on 14 Nov 2017  路  3Comments  路  Source: bootstrap-vue/bootstrap-vue

Is it possible to do something like this with a long modal, where the header remains fixed while the body of the modal scrolls? See: https://github.com/keaukraine/bootstrap4-fs-modal

Answered Question

Most helpful comment

You can use some custom CSS to target .modal-body to restrict the height and set overflow-y: scroll

.my-modal .modal-body {
  max-height: 80vh; /* max 80% of the viewport height */
  overflow-y: auto;
}

and then set my-modal class on b-modal:

<b-modal class="my-modal" title="Foobar">
   Scrollable body with long content
</b-modal>

All 3 comments

You can use some custom CSS to target .modal-body to restrict the height and set overflow-y: scroll

.my-modal .modal-body {
  max-height: 80vh; /* max 80% of the viewport height */
  overflow-y: auto;
}

and then set my-modal class on b-modal:

<b-modal class="my-modal" title="Foobar">
   Scrollable body with long content
</b-modal>

Thanks! Works great! And thanks a lot for bootstrap-vue in general. Excellent work, and very useful.

You may need to adjust the max-height depending on the heights of your modal header and footer, but 80vh is useful in most situations. You may need to test it out on small screen devices (like phones/tablets)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chaymag picture chaymag  路  3Comments

kossa picture kossa  路  3Comments

m1neral picture m1neral  路  3Comments

StephenPCG picture StephenPCG  路  3Comments

KonradDeskiewicz picture KonradDeskiewicz  路  3Comments