I have a YouTube video that I'm trying to center within a div. After adding
display: block;
to the CSS following advice from How to center an iframe horizontally?, it centers correctly, but now I want to display two images inline next to the iframe - one on the left and one on the right. The issue arises when setting the display property of the iframe to block, as it disrupts the layout for the images.
Here's the HTML:
<div class="content">
<a id="logo" href="http://www.example.com">
<img id="logo" src="img/logo.png" alt="logo">
</a>
<br>
<nav class="topNav">
<a href="index.html">
<img id="home" class="topNav" src="img/home.png" alt="home">
</a>
<a href="photos.html">
<img id="photos" class="topNav" src="img/photos.png" alt="gallery">
</a>
<a href="about.html">
<img id="about" class="topNav" src="img/about.png" alt="about">
</a>
</nav>
<br>
<img id="image1" src="img/image1.png" alt="img1">
<iframe id="video" src="http://www.youtube.com/embed/L-9y6jP-HO4"></iframe>
<img id="image2" src="image2.png" alt="img2">
<br>
<a id="downloadmp3" href="mp3/poo-on-the-shoe-ringtone.mp3" target="_blank" onmouseover="mOver()" onmouseout="mOut()">
Download the ringtone!
</a>
<br>
<a href="https://www.facebook.com" target="_blank">
<img id="facebookPic" src="img/facebook.png" alt="Like Us On Facebook">
</a>
And here's the CSS:
body {
background: #563C21;
text-align: center;
}
.content {
text-align: center;
background-color: #4D361E;
box-shadow: 0 0 150px black;
border-radius: 15%;
}
#logo {
margin: auto;
text-decoration: none;
}
.topNav {
width: 210px;
height: 50px;
margin: auto;
display: inline;
}
.topNav a {
text-decoration: none;
}
#video {
width: 540px;
height: 315px;
display: block;
margin: auto;
border: 0;
}
Is there a way to center the iframe while maintaining the inline positioning of the images?