html - DIV 向左浮动而不是停留在表格的中央

标签 html css

我正在处理网页中的表格。该表在 td 标签中包含一个由 4 个框组成的网格。我在我的 CSS 样式表中为框使用了 3D 翻转过渡。我遇到的问题是,当我将 CSS 应用于列 (td) 中的 div 时,与中心对齐的图像向左移动。我尝试将 div 的 margin-left 然后 right 设置为 auto,但仍然没有。我会提供我的部分 HTML 和 CSS 以及问题的屏幕截图。请帮助解决这个问题 -

PS:出于某种原因,我试图粘贴我的 HTML 代码,但格式不正确。

Screenshot of the webpage

HTML: enter image description here --> --> 这是背面! --> --> 支付记录

CSS:

.flip-container {
perspective: 1000;
}
/* flip the pane when hovered */
.flip-container:hover .flipper, .flip-container.hover .flipper {
    transform: rotateY(180deg);
}

.flip-container, .front, .back {
/**width: 320px;
height: 480px;**/
}

/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;

position: relative;
}

/* hide back of pane during swap */
.front, .back {
backface-visibility: hidden;

position: absolute;
top: 0;
left: 0;

}

/* front pane, placed above back */
.front {
z-index: 2;
/* for firefox 31 */
transform: rotateY(0deg);
}

/* back, initially hidden pane */
.back {
transform: rotateY(180deg);
}

最佳答案

所以在图像父div中添加text-align center

像这样:

td{
   text-align: center;
}

关于html - DIV 向左浮动而不是停留在表格的中央,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29164742/

相关文章:

html - Foundation 4 选项卡部分可以在 Reveal 中显示吗?

php - keyup if 语句的 indexOf 字符串行为很奇怪?

html - 为什么只应用了我的一些 CSS 选择器?

javascript - 为什么单击时我的 div 会变大?

css - 针对较小的屏幕分辨率优化我的页面

html - 带有边框的 h2 中的文本溢出

html - 在兄弟 div 上使用负 margin-top 覆盖带有 div 的 img 标签

html - 下划线 CSS 链接移动宽度

javascript - 列中 Bootstrap3 工具提示的 z-index 是特定于浏览器的

css - 物化滚动体