【发布时间】:2014-04-01 00:15:05
【问题描述】:
我有一个 html 页面:http://www.newsryde.com/article/1127950
我已经使用以下方法实现了一个 css 样式表:
<link href="/css/jm/v2/print.css" rel="stylesheet" type="text/css" media="print" />
我的部分 CSS 内容如下:
html,
body{
width:670px !important; /* based upon http://stackoverflow.com/questions/320357/ */
background:white;
margin:0 !important;
position:relative;
left:0;
}
但是当我去打印时,页面没有将内容对齐到左边。
我的问题是,如何将非模拟页面向左对齐,使其看起来像模拟页面?
当我进入 DevTools 并模拟打印样式表时,所有内容都正确移动到左侧,然后打印效果很好。这里有一些截图可以帮助解释:
未模拟第一次打印预览:
模拟,然后打印预览:
解决方案
感谢 Rolan Lu 提供有关转换的提示。我在print.css 文件的顶部添加了以下内容:
*,
*:after,
*:before{
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
【问题讨论】:
-
我在 Chrome Win 7 上运行良好
-
啊,我应该提到我正在使用 osx。将更新问题,感谢您检查 windows
标签: html css printing alignment