I am trying to align iframe to the center but for some reason it is showing from the left side whereas I want the iframe and it's elements to be on the center. I used the iframe inside a div but it's not working and showing from the left side. I want it to be dynamically aligned. Can anyone help?
<div id="modalReportView" class="modal fade" role="dialog">
<div class="modal-dialog modal-report">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title modalhead" style="">Report Viewer</h4>
</div>
<div id="content" class="modal-body" style="padding: 15px 30px 30px 30px; background: #808080; overflow-x: hidden;">
<iframe id="reportIframe" scrolling="no" style="width: 100%; height: 910px; border: none;">
</iframe>
</div>
<div class="modal-footer">
<div class="col-md-12">
<a href="#" class="btn btn-sm btn-danger btn-block" id="closeModalButton" data-dismiss="modal"><b><i class="glyphicon glyphicon-remove"></i> Cancel</b></a>
</div>
</div>
</div>
</div>
</div>
-----------JS code-------------------
function ViewReportDetails(_dbModel) {
$("#reportIframe").attr("src", "");
var ItemModuleFrom = jQuery.grep(moduleWiseReportClass, function (p, i) {
return (p.Module == _dbModel.ModuleFrom);
});
_dbModel.ReportHelperClass = ItemModuleFrom[0].HelperClass;
var reportUrl = "/ReportsManagement/ReportView/ReportViewer?json=" + encodeURIComponent(JSON.stringify(_dbModel)); // for rdlc report
console.log(reportUrl);
////for rdlc report
$("#loading").show();
if ($("#reportIframe")[0].contentWindow.document.readyState === 'complete') {
$("#reportIframe")
.attr("src", reportUrl)
.on('load', function () {
$("#loading").hide();
$("#modalReportView").modal('show');
});
}
$("#closeModalButton").on('click', function (e) {
$("#modalReportView").toggle();
});
}