简体   繁体   English

Susy at-breakpoint没有打破预期的点

[英]Susy at-breakpoint not breaking at intended points

I am learning Susy and I am trying to use at-breakpoint and running into some weirdness. 我正在学习Susy,我正在尝试使用at-breakpoint并遇到一些奇怪的问题。

I posted a gist and it's also on sassmeister: 我发布了一个要点,它也在sassmeister上:

http://sassmeister.com/gist/7050948 http://sassmeister.com/gist/7050948

https://gist.github.com/keithhayden/7050948 https://gist.github.com/keithhayden/7050948

I defined some variables for my media layouts: 我为媒体布局定义了一些变量:

$susy-phone-wide:       24em 8       // 384px
$susy-tablet-portrait:  30em 12      // 480px to 600px
$susy-tablet-landscape: 37.5em 16    // 600px to 768px
$susy-computer:         48em 24      // 768px to ?

Then just to see where the breakpoints are taking effect, I just have a div that changes color at each breakpoint. 然后只是为了看断点在哪里生效,我只有一个div在每个断点处改变颜色。 The problem is, it's changing color at the wrong breakpoints. 问题是,它在错误的断点处改变颜色。

  • should turn green at 384px, doesn't change until 480px ( -96px ) 应该在384px变为绿色,直到480px(-96px)才变化
  • should turn yellow at 480px, doesn't change until 600px ( -120px ) 应该在480px处变黄,直到600px(-120px)才会变化
  • should turn red at 600px, doesn't change until 750px ( -150px ) 应该在600px变红,直到750px(-150px)才变化
  • should turn purple at 768px, doesn't change until 960px ( -192px ) 应该在768px变成紫色,直到960px(-192px)才变化

perhaps my math is off on the em values for the media-layouts. 也许我的数学是关于媒体布局的em值。 I used pxtoem.com to calculate the em values. 我使用pxtoem.com来计算em值。

The actual practical use case is I'll be adding buttons that on mobile devices will be arranged top to bottom and width 100%, but once on a non-mobile device, they become width auto and are arranged right to left. 实际的实际用例是我将添加按钮,在移动设备上将从上到下排列,宽度为100%,但一旦在非移动设备上,它们将变为宽度自动并从右到左排列。

I checked it out on Ubuntu in Chrome 26 and it also seemed totally fine. 我在Chrome 26中的Ubuntu上查看了它,它似乎也很好。 But then I played around with the preferences a little in chrome://settings , where (if you show advanced settings) under 但后来我在chrome://settings使用了一些偏好,其中(如果你显示高级设置)

Web Content 网页内容

I had set this: 我设定了这个:

  • Font size: medium 字体大小: 中等
  • Page Zoom: 100% 页面缩放: 100%

If I changed the font to Large the page started behaving the way you experience it. 如果我将字体更改为“ 大”,则页面开始按照您的体验方式运行。

So this will happen no matter what if using relative units in media queries. 因此,无论在媒体查询中使用相对单位如何,都会发生这种情况。 If the browser overrides the base for the unit. 如果浏览器覆盖单元的基础。 You can change just the media queries to px and use relative units on the rest of the design ... I am not sure how this will affect your grid solution ... but it would get rid of this behavior. 您可以只将媒体查询更改为px并在设计的其余部分使用相对单位...我不确定这将如何影响您的网格解决方案......但它会摆脱这种行为。

However, when changing the font to large in the browser or zooming-in the viewport starts emulating a smaller device ... so basically, the behavior you get originally is correct (you just shouldn't look at the actual pixels anymore). 但是,当在浏览器中将字体更改为大或放大时,视口开始模拟较小的设备......所以基本上,您最初获得的行为是正确的(您不应该再看实际的像素)。 And if I would zoom-in (or set the em base huge) enough I would get the buttons arranged top-to-bottom ... because my screen width to font ( em -base) ratio would be similar to one on a handheld device. 如果我将放大(或设置em基础巨大)足够我将按钮从上到下排列...因为我的屏幕宽度与字体( em -base)比率将类似于手持设备上的一个设备。

Since I've had several people tell me all is right for them, I assume the issue is on my end. 既然我有几个人告诉我一切都适合他们,我认为这个问题就在我身边。 I have noticed that on my Ubuntu machine the fonts on some sites seem to be a little taller and wider and sometimes wrap when they don't on other systems. 我注意到在我的Ubuntu机器上,某些网站上的字体似乎更高更宽,有时在其他系统上没有。 browser is not zoomed in, so I need to ask a question in an ubuntu forum I guess. 浏览器没有放大,所以我需要在ubuntu论坛中提问。

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

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