Ferie
Ferie

Reputation: 1436

Bootstrap modal fullscreen issue

There are lot of solutions for this problem that puts height 100% and width 100%, but the solutions don't take care about the content under the modal. In my example in jsfiddle there is an error. Where am I wrong?

.modal-dialog {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

.modal-content {
  height: 100%;
  border-radius: 0;
}

Here the jsfiddle

Upvotes: 3

Views: 9728

Answers (2)

Morpheus
Morpheus

Reputation: 9065

The problem is with the height being 100% as it fills only the window height. Use min-height instead:

.modal-dialog {
    width: 100%;
    min-height: 100%;
    padding: 0;
    margin: 0;
}

Updated fiddle

Upvotes: 2

Ferie
Ferie

Reputation: 1436

I have found a solution that works and updated my jsfiddle

.modal {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
}
.modal-dialog {
    position: fixed;
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}
.modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border: none;
}
.modal-content {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    box-shadow: none;
}
.modal-body {
    position: absolute;
    top: 50px;
    bottom: 0;
    font-size: 15px;
    overflow: auto;
    margin-bottom: 60px;
    padding: 0 15px 0;
    width: 100%;
}
.modal-footer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 60px;
    padding: 10px;
    background: #f1f3f5;
}
/* to delete the scrollbar */
/*
::-webkit-scrollbar {
    -webkit-appearance: none;
    background: #f1f3f5;
    border-left: 1px solid darken(#f1f3f5, 10%);
    width: 10px;
}
::-webkit-scrollbar-thumb {
    background: darken(#f1f3f5, 20%);
}
*/

Upvotes: 2

Related Questions