【问题标题】:Centre Two Buttons with Images将两个按钮与图像居中
【发布时间】:2016-04-16 09:34:30
【问题描述】:

我正在尝试使两个按钮居中,但没有运气!

它还在 HTML 中的按钮上方有一个标题图像。

这是我当前的 HTML:

HTML:

<div>
  <img src=".jpg" style="width:700px;display:block;margin-left:auto;margin-right:auto;" alt=""><div class="nav3" style="height:705px;">
  <span class="icons"><a href="https://twitter.com/" class="icons">
    <img src=".png" style="width:100px;display:block;margin-left:auto;margin-right:auto;" alt=""></a>
  </span>   
  <a href="https://www.amazon.co.uk/" class="icons">
  <img src=".png" style="width:100px;display:block;margin-left:auto;margin-right:auto;" alt=""></a>

</div>

【问题讨论】:

  • 你能加个打印屏幕什么的吗?
  • div代码没有完成,甚至没有关闭...
  • 你想做什么?你能创建一个模拟吗?
  • 谢谢你的链接,我以后会关注它

标签: html css


【解决方案1】:

我修改了您的代码并将其内联样式与您的 html 代码分开。

div {
  text-align: center;
  width: 700px;
}
div img{
  width:700px;
  margin-bottom: 20px;
}

.nav3 img {
  width: 100px;
  display: inline;
}
<div>
  <img src="http://placehold.it/700x260" alt="">
  <div class="nav3">
    <a href="https://twitter.com/"><img src="http://placehold.it/640x260" alt=""></a>
    <a href="https://www.amazon.co.uk/"> <img src="http://placehold.it/640x260" alt=""></a>
  </div>
</div>

目前,我将div 的宽度设置为width: 700px;,并且占位符也包含相同的宽度。修改这些宽度以满足您的需要。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-08
    • 1970-01-01
    • 2015-06-26
    • 1970-01-01
    • 2018-02-23
    • 2012-02-04
    • 2013-08-07
    相关资源
    最近更新 更多