2017-03-02 74 views
-1

所以我想打印在纸张的右侧一个div,但是,当我按下Ctrl + P键谷歌浏览器,在打印预览结果,div的右侧在左边。打印一个div在纸

我正在使用bootstrap。我想这

<div class="row"> 
<div class="col-md-6"></div> 

<div id="printMe" class="col-md-6">Print this text on the right</div> 
</div> 

,但仍当我打印,文本是在纸张的左侧。

+0

尝试添加“ ”成空div .. – Rick

+1

添加右拉式类 –

+0

看到@media打印https://www.w3schools.com/css/css3_mediaqueries.asp –

回答

0

我假设页面的左边部分是空的。试试这个:

<div class="row"> 
<div id="printMe" class="col-md-6 col-md-offset-6">Print this text on the right</div> 
</div> 

参考:http://getbootstrap.com/css/#grid-offsetting

+0

简单地用右拉式 –

+0

这是有点奇怪,偏移-6不起作用,但当我使用拉右,它的工作原理 – Alvinrightback

+0

你的屏幕分辨率是多少?你必须至少有992px的屏幕宽度才能使'md'工作。 的右拉式的,是它的工作原理,但能够击败响应功能。好吧,这是打印反正。 – harritbal

0

你的代码更改为:

<div class="row"> 
<div class="col-md-6 col-md-offset-6"></div> 

<div id="printMe" class="col-md-6">Print this text on the right</div> 
</div> 
+0

感谢您的编辑,我目前在移动,所以我不知道如何正确显示代码 –

+0

我相信你的答案是正确的,但它does not。它只适用于拉右而不是偏移。谢谢你的答案。 – Alvinrightback

0

它有点离奇,偏移不是在这里工作。

其作品与

<div class="row"> 
<div class="col-md-6"></div> 

<div id="printMe" class="col-md-6 pull-right">Print this text on the right</div> 
</div> 

谢谢你们BTW。