如何使包含在固定宽度居中页面内的 div 元素“出血”到页面的左侧或右侧?
最佳答案
您可以使用float
在容器的左侧或右侧对齐一个框,如果它比容器宽,它就会以相反的方式流出。
http://jsfiddle.net/gxG4W/1/
.bleed-leeft {
float:right;
width:100%;/* this will keep content within the width of container and give a scrollbar if needed */
padding-left:9999px;/* size you want to bleed out for your purpose */
}
您可以在父级上使用direction
并在子级上重置它,因此如果body是LTR,它会从左侧流出而不是右侧,反之亦然
http://jsfiddle.net/gxG4W/2/
关于html - CSS - 'bleed' div 脱离页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21194689/