想象两个盒子并排在一起。右边的一个是向右浮动的,固定的宽度保持一张照片,左边包含文本,这样就可以将剩余的宽度填充到容器的左边边缘。
如果我调整浏览器的大小(压缩),我希望左边框中的文本保持流畅。到目前为止还不错..。
这是困难的部分:我需要左边容器的最小宽度,所以当到达时,文本框停止缩小,右边的照片框开始在左边的框下面滑动,直到它消失。这个是可能的吗?
任何帮助都很感激!
发布于 2014-03-24 05:33:46
您可以通过定位实现z-index重叠,但不能通过浮动实现重叠。你必须这样做:
代码和内联解释:
.leftbox {
position: relative; /* stay sort of in the document flow */
z-index: 2; /* be positioned at level 2 */
min-width: 200px; /* minimum width at which to stop getting smaller */
margin-right: 200px; /* catering for that right column */
background-color: rgba(155, 155, 255, 0.8); /* slightly transparent so we can see the right box go 'underneath' it */
}
.rightbox {
position: absolute; /* remove from the document flow */
right: 0; /* sit where we want it to */
top: 0; /* sit where we want it to */
z-index: 1; /* be positioned at level 1, so below level 2 */
width: 200px; /* set a width */
background-color: rgba(255, 155, 155, 0.8); /* uhh, colours are nice */
}https://stackoverflow.com/questions/22600706
复制相似问题