文本不会在列中填充容器

时间:2015-07-29 15:10:13

标签: css text flip two-columns

我一直在尝试各种列技术,我喜欢这个。我打算在它们下面再放一张图像并居中。我选择后会翻转图像。我的问题是背面的文字(.flip-item-desc)继承了容器的50%宽度(#top div)。我无法弄清楚如何使文本div填满图像的背面。

#top div, #bottom div{
background-color: aqua;
text-align: center;
margin: 1% auto;
width: 50%;
height: auto;
}
.flip-item-desc{
font-family: sans-serif;
font-weight: bold;
color: white;
text-align: center;
font-size: 80%;
line-height: 1.237;
background: rgba(0,0,0,0.5);
width: 96%;
height: auto;
margin: 2% 2%;
padding: 2%;
position: absolute;
top:0;
left: 0;
overflow: hidden;
}

我在此处复制并粘贴了托管图片的代码:https://jsfiddle.net/digi57/ojLtu049/1/

1 个答案:

答案 0 :(得分:1)

我在CSS代码中添加了几行 -

.flip-item-desc {
    min-width: 96%;
}
.back {
    overflow: hidden;
}

这里是小提琴 - https://jsfiddle.net/ojLtu049/2/