[英]How to set div position relative to another div only at printing
I am building an HTML report and I want to move some divs to be above another div @ media print only.我正在构建一个 HTML 报告,我想将一些 div 移动到另一个 div @ media print 之上。 Or, how can I set the position of a div relevant to another one?
或者,如何设置与另一个相关的 div 的 position?
example: div_2's bottom to top of div_1 means例子:div_2's bottom to top of div_1 表示
div_2
div_1
example: div_2's left to right of div_1 means示例:div_2 的从左到右表示 div_1
div_1div_2
Can I do this?我可以这样做吗?
Actually I found a very tricky solution which will enable you to change divs at print and also add page breaks if you want.实际上,我发现了一个非常棘手的解决方案,它可以让您在打印时更改 div 并在需要时添加分页符。 the solution is using Js
解决方案是使用 Js
jQuery(document).bind("keyup keydown", function(e){
if(e.ctrlKey && e.keyCode == 80){
fd = document.getElementById( '1_div' );
sd = document.getElementById( '2_div' );
sd.parentNode.insertBefore( sd, fd );
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.