I'm using bootstrap and modals for partial views, I have a "loading" div to put in front of everything while getting the data. I can't put the loading div in front of the modal, already tried with z-index but still nothing.
This is my css:
.load {
position: absolute;
z-index: 500 !important;
height: 100%;
display: none;
border: 0;
padding: .5em 1em;
overflow: auto;
top: 0%;
left: 0%;
background: white;
width: 100%;
border: none;
opacity: 0.8;
}
.imagen_loading {
position: absolute;
z-index: 500 !important;
top: 35%;
left: 43%;
width: 300px;
height: 300px;
background: url('../../Content/img/gif/loader3.gif')
}
And this is my modal:
<div class="modal fade" id="modal_aprobar_transferencia" data-target="#modal_aprobar_transferencia">
<div class="modal-dialog">
<div class="modal-content" style="overflow:auto; width:90% !important; height:90% !important;">
<div class="modal-header orange">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title"><strong></strong>Transfers</h4>
</div>
<div class="modal-body">
#{
Html.RenderAction("lista_transferencias", "Almacen");
}
</div>
</div>
</div>
</div>
Edit:
<div class="container-fluid" style="padding-left:7em; padding-right:3em;">
<h3>Storehouse</h3>
<div class="row barra_menu" style=" ">
<div class="" style="float:left;">
<button type="button" class="btn btn-lg btn-info" href="#modal_formulario_altas" data-toggle="modal">
Receives
</button>
</div>
<div class="dropdown">
<button type="button" class="btn btn-lg btn-info dropdown-toggle" data-toggle="dropdown" style="float:left;">
Transfers <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
New transfer
New seal package
See transfers
Receive transfers
</li>
</ul>
</div>
<div class="modal fade" id="modal_nuevos_sellos" data-target="#modal_nuevos_sellos">
<div class="modal-dialog" style="width:30% !important; height:15% !important;">
<div class="modal-content">
<div class="modal-header orange">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title"><strong></strong>Add seal package</h4>
</div>
<div class="modal-body">
<div class="form-group">
<div class="form-group col-3">
<label for="caja_inicio">First seal </label>
<input type="text" class="form-control numeric must " onkeydown="upperCaseF(this)" id="caja_inicio">
</div>
<div class="form-group col-3">
<label for="caja_final">Last seal</label>
<input type="text" class="form-control numeric must " onkeydown="upperCaseF(this)" id="caja_final">
</div>
<div class="form-group col-3">
<label for="caja_sucursal">Branch office </label>
<select type="text" class="form-control" id="caja_sucursal">
<option>Select</option>
<option value="1">Fortune</option>
<option value="2">Lucky one</option>
</select>
</div>
<div class="form-group col-3">
<br />
<button type="button" class="btn btn-primary mb-2" id="boton_guardar_sello" onclick="guardar_sellos_index(event);">Save</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_aprobar_transferencia" data-target="#modal_aprobar_transferencia">
<div class="modal-dialog">
<div class="modal-content" style="overflow:auto; width:90% !important; height:90% !important;">
<div class="modal-header orange">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title"><strong></strong>Approval of transfers</h4>
</div>
<div class="modal-body">
#{
Html.RenderAction("lista_transferencias", "Almacen");
}
</div>
</div>
</div>
</div>
<!----LISTADO DE INVENTARIO----->
<div class="panel panel-default panel-primary">
<div class="panel-heading"><h4>Inventory</h4></div>
<div style="padding:1em; overflow:auto; ">
<table id="tabla_inventario" class="table table-striped ">
<thead>
<tr>
<th>#Html.DisplayNameFor(model => model.id_inventario)</th>
<th>#Html.DisplayNameFor(model => model.sucursal)</th>
<th>#Html.DisplayNameFor(model => model.po)</th>
<th>#Html.DisplayNameFor(model => model.mill_po)</th>
<th>#Html.DisplayNameFor(model => model.total)</th>
<th>#Html.DisplayNameFor(model => model.categoria_inventario)</th>
<th>#Html.DisplayNameFor(model => model.descripcion)</th>
<th>#Html.DisplayNameFor(model => model.estado)</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach (var item in Model)
{
<tr>
<td>#Html.DisplayFor(modelItem => item.id_inventario)</td>
<td>#Html.DisplayFor(modelItem => item.sucursal)</td>
<td>#Html.DisplayFor(modelItem => item.po)</td>
<td>#Html.DisplayFor(modelItem => item.mill_po)</td>
<td>#Html.DisplayFor(modelItem => item.total)</td>
<td>#Html.DisplayFor(modelItem => item.categoria_inventario)</td>
<td>#Html.DisplayFor(modelItem => item.descripcion)</td>
<td>#Html.DisplayFor(modelItem => item.estado)</td>
<td>
<button type="button" onclick="ver_item(#item.id_inventario)" class="btn btn-default glyphicon glyphicon-search " style="color:black; padding:0px 5px 0px 5px;"></button>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div id="loading" class="load">
<div id="spinner" class="imagen_loading" style=""></div>
</div>
My partial views are mostly the same, tables and edits.
I'd appreciate any help.
The trick in here is data-backdrop="false" style="background-color: rgba(0, 0, 0, 0.5);" by removing the default backdrop and create a dummy one by setting background color of the dialog itself with some alpha.
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="false" style="background-color: rgba(0, 0, 0, 0.5);">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">...</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
Notes: clicking on the background does not close the dialogue as is expected.
Solution: So to achieve that you have to add some javascript code. Here is some example of how you can accomplish this.
$('.modal').click(function(event){
$(event.target).modal('hide');
});
HTML: place this within your body tag
<div id="LoaderWindow">
<div id="Loader"></div>
</div>
/* CSS for loading*/
.loader-window {
width: 100%;
height: 100%;
position: fixed;
z-index: 1051;
background: rgba(54, 70, 93, 0.95);
}
.loader {
position: absolute;
top:50%;
left:50%;
border: 8px solid #f3f3f3;
border-radius: 50%;
border-top: 8px solid #5BFEC8;
width: 60px;
height: 60px;
margin-top:-30px;
margin-left:-30px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
#-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
#keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
You have to use jquery to add class.
function loader(
operation
) {
if (operation == 'add') {
$('#LoaderWindow').addClass('loader-window');
$('#Loader').addClass('loader');
} else {
$('#LoaderWindow').removeClass('loader-window');
$('#Loader').removeClass('loader');
}
}
loader('add') would be used when you request data and after received a response use loader('remove');
When inspecting the modals within the Bootstrap (3 and 4) documentation, it looks like their default z-index is 1050. Did you try increasing the z-index of your loading div to something greater than 1050?
Try setting this styles to your loading div:
#loading {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9999;
background: url(img/preloader.gif) center no-repeat #fff;
}
Be advised, the loading <div> must be out of the modal <div>.
HTML
<div id="loading"></div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"></div>
Related
So I've been trying to add a vertical scroll into my modal. It was a half-success.
The CSS and all are working fine but I'm having this weird margin-right that seems like can't be removed.
I tried to play around with the inspect element and nothing is working.
By the way, when I removed the overflow-y: auto the layout is okay (ofc, can't be scrolled)
So in my conclusion, the CSS overflow-y: auto is the one that creates that weird margin-right.
Can someone help me or explain this to me and How to remove it?
See the images attached for details.
PS. I think no need to post the code here since it's just CSS
/* View Menu-Modal */
.modalMenu {
float: none;
width: 100%;
height: 200px;
}
.modalMenu-img {
width: 100%;
height:100%;
object-fit:cover;
border-radius: 8px;
}
.modalPrice {
font-size: 24px;
line-height: 28px;
margin: 0px;
font-family: 'Barlow', sans-serif;
}
.modal-dialog {
height: 100% !important;
}
.modal-header {
border-bottom: 0px !important;
}
.modal-content {
border: 0px !important;
height: auto;
min-height: 80%;
border-radius: 12px;
}
.modal-body {
height: 70vh;
overflow-y: auto;
/*THIS IS WHERE THE SCROLL is, when I added this ofc it ads a vertical scroll but at the same time the annoying right-margin.*/
margin-right: 0px !important;
}
.modal-footer {
border-top: 0px !important;
}
#view-menu-modal::-webkit-scrollbar {
display:none
}
<!-- Modal -->
<div class="modal fade" id="viewMenuModal<?= $menu_id ?>" tabindex="-1" role="dialog" aria-labelledby="viewOrderModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="view-menu-modal"> <!--THIS IS WHERE THE OVERFLOW-Y: auto is applied -->
<div class="modalMenu mb-2">
<img class="modalMenu-img" src="images/img/stock/baby-back-ribs.jpeg" alt="blog-img">
</div>
<div class="content-right">
<h3><?= $menu_name ?></h3>
<p class="food-description"><?= $menu_desc ?></p>
<p class="modalPrice">₱ <?= $menu_price ?> </p>
</div>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-lg btn-secondary" data-dismiss="modal">Close</button> -->
<button type="button" class="btn btn-lg primary-btnLink mb-1">Add to Order</button>
<button type="button" class="btn btn-lg secondary-ghostBtn" data-dismiss="modal" aria-label="Cancel">Cancel</button>
</div>
</div>
</div>
</div>
This is the screenshot of the weird right-margin produced by the overflow-y: auto
See how it looks like
And this is the elements panel, weird that there's no right-margin value.
Weird margin-right
Full Inspect Element Panel
If you want to say that you have added a vertical scrollbar but it automatically overflows in the x-axis. Then add this property also overflow-x: hidden it will remove spaces on the right side or will remove the horizontally scrollbar.
Try setting the overflow-y to overlay. This should make the scrollbar appear only as an overlay, thus not affecting the width of your element!
.modal-body{
overflow-y: overlay;
}
You can use overflow-y: scroll; on your modal body. I changed your height to 200px to demonstrate. Also, for the margin, try just margin-right: 0; instead of scroll-margin-right
/* View Menu-Modal */
.modalMenu {
float: none;
width: 100%;
height: 200px;
}
.modalMenu-img {
width: 100%;
height:100%;
object-fit:cover;
border-radius: 8px;
}
.modalPrice {
font-size: 24px;
line-height: 28px;
margin: 0px;
font-family: 'Barlow', sans-serif;
}
.modal-dialog {
height: 100% !important;
}
.modal-header {
border-bottom: 0px !important;
}
.modal-content {
border: 0px !important;
height: auto;
min-height: 80%;
border-radius: 12px;
}
.modal-body {
/*THIS IS WHERE THE SCROLL is, when I added this ofc it ads a vertical scroll but at the same time the annoying right-margin.*/
height: 200px;
margin-right: 0px !important;
overflow: scroll;
}
.modal-footer {
border-top: 0px !important;
}
<!-- Modal -->
<div class="modal fade" id="viewMenuModal<?= $menu_id ?>" tabindex="-1" role="dialog" aria-labelledby="viewOrderModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="view-menu-modal"> <!--THIS IS WHERE THE OVERFLOW-Y: auto is applied -->
<div class="modalMenu mb-2">
<img class="modalMenu-img" src="images/img/stock/baby-back-ribs.jpeg" alt="blog-img">
</div>
<div class="content-right">
<h3><?= $menu_name ?></h3>
<p class="food-description"><?= $menu_desc ?></p>
<p class="modalPrice">₱ <?= $menu_price ?> </p>
<p>Lorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsumLorem ipsum</p>
</div>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-lg btn-secondary" data-dismiss="modal">Close</button> -->
<button type="button" class="btn btn-lg primary-btnLink mb-1">Add to Order</button>
<button type="button" class="btn btn-lg secondary-ghostBtn" data-dismiss="modal" aria-label="Cancel">Cancel</button>
</div>
</div>
</div>
</div>
in this your code working fine,if possible use bootstrap css and js
.modalMenu {
float: none;
width: 100%;
height: 200px;
}
.modalMenu-img {
width: 100%;
height:100%;
object-fit:cover;
border-radius: 8px;
}
.modalPrice {
font-size: 24px;
line-height: 28px;
margin: 0px;
font-family: 'Barlow', sans-serif;
}
.modal-dialog {
height: 100% !important;
}
.modal-header {
border-bottom: 0px !important;
}
.modal-content {
border: 0px !important;
height: auto;
min-height: 80%;
border-radius: 12px;
}
.modal-body {
height: 70vh;
overflow-y: auto;
/*THIS IS WHERE THE SCROLL is, when I added this ofc it ads a vertical scroll but at the same time the annoying right-margin.*/
margin-right: 0px !important;
}
.modal-footer {
border-top: 0px !important;
}
#view-menu-modal::-webkit-scrollbar {
/*display:none*/
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#viewMenuModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="viewMenuModal" tabindex="-1" role="dialog" aria-labelledby="viewOrderModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="view-menu-modal"> <!--THIS IS WHERE THE OVERFLOW-Y: auto is applied -->
<div class="modalMenu mb-2">
<img class="modalMenu-img" src="https://image.freepik.com/free-psd/fast-food-concept-banner-template_23-2148777964.jpg" alt="blog-img">
</div>
<div class="content-right">
<h3><?= $menu_name ?></h3>
<p class="food-description"><?= $menu_desc ?></p>
<p class="modalPrice">₱ <?= $menu_price ?> </p>
</div>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-lg btn-secondary" data-dismiss="modal">Close</button> -->
<button type="button" class="btn btn-lg primary-btnLink mb-1">Add to Order</button>
<button type="button" class="btn btn-lg secondary-ghostBtn" data-dismiss="modal" aria-label="Cancel">Cancel</button>
</div>
</div>
</div>
</div>
I am trying to get a PDF to show in a bootstrap modal. Although it is appearing and all the modal functionality is working the PDF displays to the right of the modal
I have tried increasing the modal width.
HTML:
<div class='col-3'>
<div class="container">
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Application_ccps.pdf</h4>
</div>
<div class="modal-body">
<object width=500 height=575 data="Application_ccps.pdf"></object>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="panel panel-default" id="thepanel">
<div class="panel-heading" id="panelheading">Documents submitted: 5</div>
<div class="panel-body" id="panelbody">
<img src="pdficon.png"> <button class="pdfbutton" data-toggle="modal" data-target="#myModal">Application_ccps.pdf</button><br>
<img src="pdficon.png"> <button class="pdfbutton" data-toggle="modal" data-target="#myModal">Application_ccps.pdf</button><br>
<img src="pdficon.png"> <button class="pdfbutton" data-toggle="modal" data-target="#myModal">Application_ccps.pdf</button><br>
<img src="pdficon.png"> <button class="pdfbutton" data-toggle="modal" data-target="#myModal">Application_ccps.pdf</button><br>
<img src="pdficon.png"> <button class="pdfbutton" data-toggle="modal" data-target="#myModal">Application_ccps.pdf</button><br>
</div>
</div>
</div>
</div>
CSS:
#thepanel {
width: 300px;
height: 100%;
max-height: 500px;
line-height: 30px;
font-family: Segoe UI;
}
.pdfbutton {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}
.modal-body {
text-align: center;
}
The expected result is for when the PDF names are clicked a PDF pops up contained within the modal however this does not seem to be the case.
You can simply use iframe instead of the object tag.
<iframe width=500 height=575 src="path_to_your_pdf.pdf"></iframe>
you could create an individual modal for each file, and set different ids for each so you can call them on your buttons
<img src="pdficon.png"> <button class="pdfbutton" data-toggle="modal" data-target="#myModal01">Application_ccps.pdf</button><br>
<div class='col-3'>
<div class="container">
<div class="modal fade" id="myModal01" role="dialog">
...
</div>
</div>
</div>
I have a modal, and I have a background image in it. The only thing I need to do is scale it down. However, when I change the "width", it actually changes the modal's width. I can't come up with a solution. I have read many other posts here on Stackoverflow as well as other sites (such as css tricks) but I can not find a solution. Any thoughts will be more than welcome.
/* Login Modal */
.login-modal-content {
background-image: url('https://cdn.reebit.cl/images/isotipo.png');
background-repeat: no-repeat;
width: 100%;
height: auto;
background-position: right 20px bottom 10px;
}
.login-modal-header {
border-bottom: 0px;
}
.login-modal-body {
width: 100%;
margin: 0 auto;
}
.login-modal-body img {
width: 60%;
}
// My html seems correct to me //
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<div class="modal fade bd-example-modal-lg login-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="loginModal">
<div class="modal-dialog modal-lg">
<div class="modal-content login-modal-content">
<div class="modal-header login-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img login-modal-body text-center col-lg-6 pb-5 pt-0">
<img src="https://cdn.reebit.cl/images/header-logo.svg">
<h5>¡Hola! Ingresa a tu cuenta</h5>
<form class="login-form">
<div class="form-group login-modal-form-email">
<input type="text" class="form-control" id="formGroupExampleInput" placeholder="Correo electrónico">
</div>
<div class="form-group login-modal-form-password">
<input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Clave">
</div>
<button type="submit" class="btn btn-block btn-modal-login">Ingresar</button>
</form>
Olvidé mi clave
</div>
</div>
</div>
</div>
You probably wanna try using background-size CSS property:
/* Login Modal */
.login-modal-content {
background-size: cotain; // Or 'cover'
background-image: url('https://cdn.reebit.cl/images/isotipo.png');
background-repeat: no-repeat;
width: 100%;
height: auto;
background-position: right 20px bottom 10px;
}
There's a very good tutorial here too: https://css-tricks.com/almanac/properties/b/background-size/
when I use the bootstrap's modal like this:
<style>
.modal-content {
border-radius: 60px;
}
</style>
<div id="upload-loading" class="modal" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button id="loadingClose" type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Upload in progress...</h4>
</div>
</div>
</div>
</div>
it shows an underline
I tried to add this style
<style>
.modal-content, .modal-content * {
text-decoration: none !important;
}
</style>
but it doesn't seem to make any difference..
.modal-content {border: 0px solid rgba(0, 0, 0, 0.2);}
Just give border to the class .modal-header
I just solve it in React
<div>
{/* Button trigger modal */}
<button type="button" className="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Launch demo modal
</button>
{/* Modal */}
<div className="modal fade" id="exampleModalCenter" tabIndex={-1} role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div className="modal-dialog modal-dialog-centered" role="document">
<div className="modal-content">
<div className="modal-header" style={{border:"1px solid #fff"}}>
<h5 className="modal-title" id="exampleModalLongTitle">Buy Premium</h5>
<button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div className="modal-body">
<p>Your account is limited to only 3 CV views.
To review more, purchase Premium Subscription</p>
<button className="btn btn-primary">Purchase</button>
</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
I have a bootstrap modal window on my site that I can't seem to get styled consistently.
This is what my first modal looks like (and how I want it styled):
This is the 2nd modal window and styling:
here is the css that styles the title and the close:
.modal-title {
margin: 10px !important;
}
.close {
opacity: 1 !important;
position: relative !important;
padding-right: 15px !important;
top: 7px !important;
left: 3px !important;
}
Here is a copy of the relevant html for the modal windows:
<div id="movie" class="modal fade" role="dialog" tabindex='-1'>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><i class="fa fa-close"></i></button>
<h4 class="modal-title">They Live (1988)</h4>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
<div id="contactUs" class="modal fade" role="dialog" tabindex='-1'>
<div class="modal-dialog">
<div class="modal-content">
<div classs="modal-header">
<button type="button" class="close" data-dismiss="modal"><i class="fa fa-close"></i></button>
<br>
<h4 class="modal-title">Send Me a Note</h4>
</div>
<div class="modal-body">
<form id="contact-send" method="post" action="">
...
</form>
</div>
</div>
</div>
</div>
The html to call the modals:
Movie
and
<button type="button" class="cta btn btn-lg btn-success" data-keyboard="true" data-toggle="modal" data-target="#contactUs">Contact Us</button>
edit 1: There are no parent divs. I did as suggested and removed the !important elements. I do have a form on the 2nd modal window and an iframe in the first, maybe this has to do with margins being set by those rules...looking into that now. Anyway this is what it looks like right now for the form:
and:
Edit2:
Messing around with my code a bit more, I see that if I remove the modal-header class and put the elements into modal-content that it seems to work. I'll post a final edit if I figure out anything else.
It is a simple syntax error that you may have overlooked.
The .modal-header inside #contactUS is not working because the class attribute is written as classs. Simply remove the extra letter.
You have a <br> tag before the h4 which I assume you added as an attempt to solve the problem. It is not needed so you can remove it.
The correct code would be like this:
.modal-title {
margin: 10px !important;
}
.close {
opacity: 1 !important;
position: relative !important;
padding-right: 15px !important;
top: 7px !important;
left: 3px !important;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
Movie
<button type="button" class="cta btn btn-lg btn-success" data-keyboard="true" data-toggle="modal" data-target="#contactUs">Contact Us</button>
<div id="movie" class="modal fade" role="dialog" tabindex='-1'>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><i class="fa fa-close"></i></button>
<h4 class="modal-title">They Live (1988)</h4>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
<div id="contactUs" class="modal fade" role="dialog" tabindex='-1'>
<div class="modal-dialog">
<div class="modal-content">
<!-- was classs -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><i class="fa fa-close"></i></button>
<!-- <br> -->
<h4 class="modal-title">Send Me a Note</h4>
</div>
<div class="modal-body">
<form id="contact-send" method="post" action="">
...
</form>
</div>
</div>
</div>
</div>
jsFiddle: https://jsfiddle.net/azizn/j1sb9gz3/