I am using the react boostrap modal and trying to position it evenly centered and currently i am specifying the width of the modal and then setting the margin-left on the modal-dialog class to 285px !important which seems to work. But how do i make it so when the screen size goes below xl size, the margin should be 100px.
Here is the link to the codepen.
My CSS looks like this:-
.modal-content {
width: 1200px
}
.modal-dialog {
margin-left: 285px !important
}
@media screen and (max-width: 1000px) {
.modal-dialog {
margin-left: 100px !important
}
}
Apparently, the media query doesn't seem to work. Or is there a way to set the modal to always be centered regardless of the screen size?
If you use flex it is a piece of cake:
This will always center it vertically and horizontal.