简体   繁体   English

如何设置可疑容器的宽度和最大宽度

[英]How to set the width AND max-width of a susy container

I would like to achieve this mixin natively with Susy: 我想用Susy在本地实现此混合:

@mixin mainContainer($width, $maxWidth) {
  width: $width;
  max-width: $maxWidth;
  margin-right: auto;
  margin-left: auto;
}

How can I do that? 我怎样才能做到这一点?

Thanks! 谢谢!

The only reason to use Susy for this mixin is if you want Susy to provide one of those two values. 将Susy用于此mixin的唯一原因是,如果您希望Susy提供这两个值之一。 If you plan to pass in both the width and max-width explicitly as arguments, there's no need to involve Susy at all. 如果您打算显式地将width和max-width都作为参数传递,则根本不需要Susy。

I'll assume you do want Susy to provide one of the values, so I'll just guess which one, and let you change it if I guess wrong. 我假设您确实希望Susy提供其中一个值,所以我只猜测哪个值,如果我猜错了,让您更改它。 In order to use Susy with customized output, you'll use the container() function instead of the container() mixin: 为了将Susy与自定义输出一起使用,您将使用container()函数而不是container() mixin:

@mixin mainContainer($max-width, $susy: $susy) {
  width: container($susy);
  max-width: $max-width;
  margin-right: auto;
  margin-left: auto;
}

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

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