Positioning Two Images Side by Side
When attempting to center two images horizontally, it's common to encounter issues where the images appear vertically aligned instead. To resolve this, consider the following:
Original CSS:
<code class="css">#fblogo { display: block; margin-left: auto; margin-right: auto; height: 30px; }</code>
Improved CSS:
<code class="css">.fblogo { display: inline-block; margin-left: auto; margin-right: auto; height: 30px; } #images{ text-align:center; }</code>
Changes:
Modified HTML:
<code class="html"><div id="images"> <a href="mailto:[email protected]"> <img class="fblogo" border="0" alt="Mail" src="http://olympiahaacht.be/wp-content/uploads/2012/07/email-icon-e1343123697991.jpg"/> </a> <a href="https://www.facebook.com/OlympiaHaacht" target="_blank"> <img class="fblogo" border="0" alt="Facebook" src="http://olympiahaacht.be/wp-content/uploads/2012/04/FacebookButtonRevised-e1334605872360.jpg"/></a> </div></code>
These modifications ensure that the images are displayed inline within the images div and are horizontally centered within the parent container.
The above is the detailed content of How to Center Two Images Side by Side?. For more information, please follow other related articles on the PHP Chinese website!