我在这里做错了什么?
我是网络开发世界的新手。
我想把这两张图片放在中心,而且没有这样的运气:
<!-- WHITE SPACE LOGO AREA -->
<div style="background-color:white;color:white;padding:20px;">
<img src="/wp-content/uploads/2017/01/affiliate-color-logo.jpg" alt="American Welding Society Member" class="midImg">
<img src="/wp-content/uploads/2017/01/ASNT-corp_mem_logo_webrgb.jpg" alt="ASNT Corporate Partner" class="midImg">
</div>
答案 0 :(得分:0)
您可以使用text-align: center
,请参阅此示例:
<div style="background-color:white;color:white;padding:20px;text-align: center;">
<img src="/wp-content/uploads/2017/01/affiliate-color-logo.jpg" alt="American Welding Society Member" class="midImg">
<img src="/wp-content/uploads/2017/01/ASNT-corp_mem_logo_webrgb.jpg" alt="ASNT Corporate Partner" class="midImg">
</div>
&#13;
但更好的做法是不使用内联样式,请使用类和CSS查看以下改进的代码:
.images {
background-color:white;
color:white;
padding:20px;
text-align: center;
}
&#13;
<div class="images">
<img src="/wp-content/uploads/2017/01/affiliate-color-logo.jpg" alt="American Welding Society Member" class="midImg">
<img src="/wp-content/uploads/2017/01/ASNT-corp_mem_logo_webrgb.jpg" alt="ASNT Corporate Partner" class="midImg">
</div>
&#13;