html – Page-break-inside:避免不工作

我有一个用于我的(wordpress)网站的打印样式表,我想要在单个页面上打印图像而不是在页面上拆分.在某些情况下,甚至文本行都在页面之间分割.我在我的打印样式表中包含了img {page-break:avoid;),但没有运气.我找到了一些以前的答案,但它们有点老了.

是否有可靠的方法在单个页面上打印中等大小的图像而不是在页面上拆分?为什么文本行跨页?

网站:http://74.220.217.211/housing-developments/grafton-townhomes/

相关文章

> Print styles: How to ensure image doesn’t span a page break
> What are most useful media=”print” specfic,cross browser compatible css properties?
> What is the correct way to do the CSS to avoid page breaks?
> page-break-inside doesn’t work in Chrome?
> Work around for page-break-inside:avoid

解决方法

试试这个:
.site-container,.site-inner (heck body tag possibly) {position:relative;}

p {
    page-break-inside: avoid;
    position: relative; 
}

检查这个FIDDLE

在打印介质中添加

我只是在Chrome中查看它,它看起来很好,减去了还需要这个的图像:

img {
    page-break-before: auto;
    page-break-after: auto; 
    page-break-inside: avoid;
    display: block;
}

最后wordpress有这个,但实际上不确定它是否有帮助……

<!--nextpage-->

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些