[英]How to set padding on the container?
I have a header full width and I want to set padding on it using the Susy math, instead of being rewriting every time the padding of the containers in my layout. 我的标题全宽,我想使用Susy数学在其上设置填充,而不是每次在布局中填充容器时都进行重写。
For example: 例如:
CSS: CSS:
@import "susy";
@import "compass/reset";
$susy: (
columns: 12,
gutter-position: inside,
global-box-sizing: border-box
);
#header {
height: 80px;
background: red;
}
#footer {
height: 80px;
background: blue;
}
Html: HTML:
<header id="header"></header>
<footer id="footer"></footer>
Both of them are full width, but there's no padding, of course. 它们都为全宽,但是当然没有填充。 The thing is: How can I insert the same padding of the entire Susy default, like the
span
without the need of doing this manually with padding-left
and padding-right
on containers? 问题是:如何在整个Susy默认值中插入相同的填充,例如
span
而无需在容器上使用padding-left
和padding-right
手动进行此操作?
Susy doesn't do anything with container padding. Susy对容器填充不做任何事情。 There is no Susy way to do it, but you can create your own mixin or placeholder class to handle it for you (even using susy along the way):
没有Susy的方法可以执行此操作,但是您可以创建自己的mixin或占位符类来为您处理(甚至在此过程中使用susy):
$container-padding: gutter(); // any size you want
@mixin container-padding($size: $container-padding) {
padding-left: $size;
padding-right: $size;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.