【问题标题】:HTML/CSS - Landscape and Portrait optionsHTML/CSS - 横向和纵​​向选项
【发布时间】:2016-06-30 13:23:13
【问题描述】:

我有一个 html 页面和一个链接的 css 页面,它们在链接时可以完美地显示和打印(纵向)。

当我选择横向选项时,它的显示方式相同,但由于我设置的分页符和间距,它的打印效果很差。

我的问题是,是否可以为不同的页面方向设置不同的 css 页面?如果是这样,我是否应该将其他选项添加到 HTML/CSS 链接中?

【问题讨论】:

标签: html css printing landscape portrait


【解决方案1】:

您可以使用一个 css 文件,例如,您可以为每个设备和每个方向指定 css 类:像这样:

/* Portrait and Landscape */
@media only screen and (min-device-width: 320px) and (max-device-width:480px) and (-webkit-min-device-pixel-ratio: 2) {

 }

/* Portrait */
@media only screen and (min-device-width: 320px) and (max-device-width:480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
  }

/* Landscape */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) {
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-29
    • 2015-09-09
    • 1970-01-01
    • 1970-01-01
    • 2012-08-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多