翻来翻去翻到这么一句话:
It's up to the user and their browser settings to print or not print background images. To keep yourself from relying on that, put the images in the foreground in HTML.
也就是说我们不能把img放到background。但是不放到background又不能居中
找到一个不用background来居中imag的方法: 转载 http://www.brunildo.org/test/img_center.html
可以这样写:
http://davidwalsh.name/optimizing-content-print-css
http://davidwalsh.name/css-page-breaks
It's up to the user and their browser settings to print or not print background images. To keep yourself from relying on that, put the images in the foreground in HTML.
也就是说我们不能把img放到background。但是不放到background又不能居中
找到一个不用background来居中imag的方法: 转载 http://www.brunildo.org/test/img_center.html
.wraptocenter { display: table-cell; text-align: center; vertical-align: middle; width: ...; height: ...; } .wraptocenter * { vertical-align: middle; } /*\*//*/ .wraptocenter { display: block; } .wraptocenter span { display: inline-block; height: 100%; width: 1px; } /**/当然你要为你的img建一个container, 假设为wraptocenter
可以这样写:
这里有另外两篇文章介绍了如何正确处理print的问题:
http://davidwalsh.name/optimizing-content-print-css
http://davidwalsh.name/css-page-breaks
评论
发表评论