【问题标题】:Elements affecting text-align:center of other elements影响文本对齐的元素:其他元素的中心
【发布时间】:2018-04-05 18:02:55
【问题描述】:

这是我的代码。我希望 TimeDisplay 位于同一位置,但标题仍位于该 div 的中心。

<html>
  <div style="background-color:seagreen; width:100%; height:12.5%; text-align:center; display:table;">
    <a style="color:aqua; font-family:Calibri; font-size:4vmax; font-weight:700; text-decoration:none; display:table-cell; vertical-align:middle;" href="Home.html">Soogbad's Website</a>
    <h2 id="TimeDisplay" style="color:aqua; font-family:Calibri; font-size:1.25vmax; display:table-cell; vertical-align:middle;">00/00/0000 00:00:00</h2>
  </div>
</html>

我该怎么做?

【问题讨论】:

    标签: html css text-align


    【解决方案1】:

    尝试将style="position: absolute;" 用于时间显示

    【讨论】:

    • 谢谢 没想到
    猜你喜欢
    • 2012-07-12
    • 2016-01-22
    • 2019-03-16
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 2021-07-30
    • 2010-09-19
    • 2011-05-29
    相关资源
    最近更新 更多