【问题标题】:HTML align legend element in the center doesnt work in internet expl and firefox中心的 HTML 对齐图例元素在 Internet Explorer 和 Firefox 中不起作用
【发布时间】:2014-03-05 16:55:29
【问题描述】:

我想在图例的中心放置一张图片。这是链接http://codepen.io/e6z6a6z/details/IJnoF .. 这在 chrome 中运行良好,但在 Firefox 和 Internet Explorer 中,图像向左浮动。我尝试给我的图例 100% 保持它的文本对齐中心,但然后边框顶部消失了..我想要相同的边框宽度和图像之间..请帮助

【问题讨论】:

标签: html css css-float


【解决方案1】:

align="center" attribute 添加到图例标签

【讨论】:

【解决方案2】:

你必须给元素,其中有 text-align: center; 100% 宽度,它必须是块元素。之后,容器内的元素应该居中。

legend {
  display: block;
  width: 100%;
  text-align: center;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-15
    • 2016-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-08
    • 2016-10-16
    相关资源
    最近更新 更多