【问题标题】:All bootstrap breakpoints deprecated?不推荐使用所有引导断点?
【发布时间】:2015-01-30 04:11:36
【问题描述】:

查看 variables.less(以及通过谷歌搜索),似乎所有引导程序的断点少变量都已弃用。它是否正确?如果我们想根据引导程序的屏幕大小断点分配样式,有人知道我们应该使用什么吗?使用带有 LESS 的 Bootstrap v3.1.1。谢谢。

//== Media queries breakpoints
//
//## Define the breakpoints at which your layout will change, adapting to different screen sizes.

// Extra small screen / phone
//** Deprecated `@screen-xs` as of v3.0.1
@screen-xs:                  480px;
//** Deprecated `@screen-xs-min` as of v3.2.0
@screen-xs-min:              @screen-xs;
//** Deprecated `@screen-phone` as of v3.0.1
@screen-phone:               @screen-xs-min;

// Small screen / tablet
//** Deprecated `@screen-sm` as of v3.0.1
@screen-sm:                  768px;
@screen-sm-min:              @screen-sm;
//** Deprecated `@screen-tablet` as of v3.0.1
@screen-tablet:              @screen-sm-min;

// Medium screen / desktop
//** Deprecated `@screen-md` as of v3.0.1
@screen-md:                  992px;
@screen-md-min:              @screen-md;
//** Deprecated `@screen-desktop` as of v3.0.1
@screen-desktop:             @screen-md-min;

// Large screen / wide desktop
//** Deprecated `@screen-lg` as of v3.0.1
@screen-lg:                  1200px;
@screen-lg-min:              @screen-lg;
//** Deprecated `@screen-lg-desktop` as of v3.0.1
@screen-lg-desktop:          @screen-lg-min;

【问题讨论】:

  • 不,不是全部...实际上除了xs 之外的所有@screen-*-min 都不会被弃用,而是会被使用。

标签: css twitter-bootstrap less


【解决方案1】:

@seven-phases-max 说了什么。 @screen-{sm,md,lg}-min 变量是您应该使用的变量。其他的已被弃用,取而代之的是这些。

并且@screen-xs-min 已被弃用,因为 XS 没有最窄的屏幕尺寸(除非您想计算 1px),因为它是最小的断点。 (同样,LG 没有最大宽度。)

【讨论】:

  • 我明白了,谢谢。所以只是为了确认,这些是不被弃用的三个:'@screen-sm-min''@screen-md-min''@screen-lg-min'但其余的(包括两个'@screen-xs -min' 和 '@screen-xs') 是?只是想清楚一点,因为虽然您关于“@screen-xs-min”的观点完全有道理,但没有“@screen-xs”将是一种遗憾。
  • 正如代码中的注释所说,@screen-xs 已被弃用。非最小变量只是“-min”变量的不推荐使用的别名。您可能还对未弃用的计算“-max”变量感兴趣。
  • 不要强调这一点,但令人困惑的部分是“-min”变量似乎是非最小变量的别名,而不是相反(例如@screen-md-分钟:@screen-md)。这似乎很奇怪,因为非最小变量是被弃用的变量。无论如何,似乎很清楚,今后我将为“-min”变量设置显式值,以便它们不依赖于已弃用的变量。谢谢。
  • 必须这样才能为那些在“-min”变量甚至存在之前就开始覆盖现已弃用的变量的人保持向后兼容性。
  • 在新产品中不必这样 - 它只是旧的东西造成混乱。我质疑弃用 screen-xs-min - 尽管没有明确的最小尺寸,但许多 Bootstrap 元素将低于 280 或 320 像素。无论如何,大多数浏览器都不会让你缩放到这个值以下。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-21
  • 2016-04-22
  • 2012-11-14
  • 1970-01-01
  • 1970-01-01
  • 2013-05-26
相关资源
最近更新 更多