简体   繁体   English

如何在Zurb Foundation基于html的网格类中定位不同的方向?

[英]How do you target different orientations in Zurb Foundation's html-based grid classes?

This question only concerns prototyping; 这个问题仅涉及原型。 I know it can be done with semantic grid classes via (S)CSS, but I'm referring to Zurb Foundation's unsemantic html-based grid classes. 我知道可以通过(S)CSS使用语义网格类来完成,但是我指的是Zurb Foundation基于HTML的非语义网格类。

I'm trying to do something like this – why won't it seem to work? 我正在尝试做这样的事情-为什么它似乎不起作用?

<div class="medium-portrait-4 medium-landscape-7">...</div>
<div class="medium-portrait-8 medium-landscape-5">...</div>

As of Zurb Foundation v5.3.0 There is no out of package class for targeting orientations directly such as you describe above. 从Zurb Foundation v5.3.0开始,没有像上面所描述的那样直接用于定向的包外类。

However by employing mixins one can create a custom class that provides the desired outcome such as the following example I copied from the a similar question on the foundation site . 但是,通过使用mixins,可以创建提供所需结果的自定义类,例如以下示例,我从基础站点上的类似问题中复制了此示例。

.class-name { 
  @media #{$small-only} and (orientation: portrait) { 
    @include grid-column(2);
  }
  @media #{$small-only} and (orientation: landscape) { 
    @include grid-column(4);
  }
 @media #{$medium-up} and (orientation: landscape) { 
    @include grid-column(6);
  } 
}

To make this, i change the breakpoints in _settings.scss: 为此,我更改了_settings.scss中的断点:

small: 0,
medium: 750px,
large: 970px,
xlarge: 1170px,
xxlarge: 1440px,

when i use small col for mobile, medium col for tablet portrait, large col for tablet landscape 当我将列用于移动,将列用于平板电脑肖像,将列用于平板电脑风景时

its make the job 它使工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM