From 30263f2620d8b4e7e5f53ad52ab9d07e1d372e10 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 22 Oct 2017 22:32:51 -0700 Subject: [PATCH 1/5] Add .modal-dialog-centered for optional vertically cenetered modal Fixes #23638 --- docs/4.0/components/modal.md | 58 ++++++++++++++++++++++++++++++++++++ scss/_modal.scss | 8 +++++ 2 files changed, 66 insertions(+) diff --git a/docs/4.0/components/modal.md b/docs/4.0/components/modal.md index c4191b83d1fe..d46d6fdaffcc 100644 --- a/docs/4.0/components/modal.md +++ b/docs/4.0/components/modal.md @@ -208,6 +208,64 @@ When modals become too long for the user's viewport or device, they scroll indep {% endhighlight %} +### Vertically centered + +Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal. + + + +
+ +
+ +{% highlight html %} + + + + + +{% endhighlight %} + ### Tooltips and popovers [Tooltips]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/tooltips/) and [popovers]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/popovers/) can be placed within modals as needed. When modals are closed, any tooltips and popovers within are also automatically dismissed. diff --git a/scss/_modal.scss b/scss/_modal.scss index 5fabc83f46e8..f0f60b18069d 100644 --- a/scss/_modal.scss +++ b/scss/_modal.scss @@ -50,6 +50,14 @@ } } +.modal-dialog-centered { + display: flex; + align-items: center; + height: 100%; + margin-top: 0; + margin-bottom: 0; +} + // Actual modal .modal-content { position: relative; From 95384fbfc5d1f30446db027898d1bd447bb5ac38 Mon Sep 17 00:00:00 2001 From: Andres Galante Date: Mon, 23 Oct 2017 09:08:03 -0300 Subject: [PATCH 2/5] adds modal-dialog-centered class to docs and removes margin to avoid generating a vertical scrolling --- docs/4.0/components/modal.md | 2 +- scss/_modal.scss | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/4.0/components/modal.md b/docs/4.0/components/modal.md index d46d6fdaffcc..ebb671a17abf 100644 --- a/docs/4.0/components/modal.md +++ b/docs/4.0/components/modal.md @@ -213,7 +213,7 @@ When modals become too long for the user's viewport or device, they scroll indep Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.