简体   繁体   English

如何在容器上设置填充?

[英]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-leftpadding-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.

相关问题 如何将边距或填充设置为父容器高度的百分比? - How to set the margin or padding as percentage of height of parent container? 角材料-如何设置垫水平内容容器填充0 - Angular Material - how to set mat-horizontal-content-container padding 0 如何用填充来使溢出的容器居中? - How to centerize overflowed container with padding? 如何在Susy中设置最大填充宽度,以使填充/边距在较大的视口中保持增长? - How to set a maximum container-width in Susy that only the padding/margin keeps growing on larger viewports? 如何将内边距或边距或任何属性设置为元素尺寸的百分比而不是父容器尺寸 - How to set the padding or margin or any property as a percentage of elements dimension and not parent container dimension 如何将填充设置为延伸到父容器的顶部和底部边缘? - How can I set the padding to extend till the top and bottom edges of the parent container? 如何填充更改引导容器类 - How to padding in change bootstrap container class 如何在CSS的div中设置填充 - How to set padding in the divs in CSS 如何设置占位符文本的填充 - How to set the padding of placeholder text 如何为设备设置边距/填充 - How to set margin/padding for a device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM