Center iframe
Edit: FLEX solution
Using display: flex
on the <div>
div {
display: flex;
align-items: center;
justify-content: center;
}
JSFiddle: https://jsfiddle.net/h9gTm/867/
One solution is:
div {
text-align:center;
width:100%;
}
iframe{
width: 200px;
}
<div>
<iframe></iframe>
</div>
Run code snippetExpand snippet
JSFiddle: https://jsfiddle.net/h9gTm/
edit: vertical align added
css:
div {
text-align: center;
width: 100%;
vertical-align: middle;
height: 100%;
display: table-cell;
}
.iframe{
width: 200px;
}
div,
body,
html {
height: 100%;
width: 100%;
}
body{
display: table;
}
JSFiddle: https://jsfiddle.net/h9gTm/1/