Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions utilities/container.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# Container
# 容器 {#container}

## Container
## 容器 {#container}

A component for fixing an element's width to the current breakpoint.
根据当前断点固定元素宽度的组件。

| Class | Breakpoint | Properties |
| :---- | :------------- | :----------------- |
| 类名 | 断点 | 属性 |
| :-------- | :------------- | :----------------- |
| container | *None* | width: 100%; |
| | sm *(640px)* | max-width: 640px; |
| | md *(768px)* | max-width: 768px; |
| | lg *(1024px)* | max-width: 1024px; |
| | xl *(1280px)* | max-width: 1280px; |
| | 2xl *(1536px)* | max-width: 1536px; |

### Usage
### 用法 {#usage}

To center a container, use the mx-auto utility:
要使一个容器居中,请使用 `mx-auto` 工具类:

```html
<div class="container mx-auto">
<!-- ... -->
</div>
```

To add horizontal padding, use the `px-{size}` utilities:
要添加水平内边距,请使用 `px-{size}` 工具类:

```html
<div class="container mx-auto px-4">
<!-- ... -->
</div>
```

To use a container at only a certain breakpoint and up:
要只把某个断点及上层元素当作容器,请使用如下方法:

```html
<!-- Full-width fluid until the `lg` breakpoint, then lock to container -->
<!-- 在达到 `lg` 断点前保持全幅宽,在达到后锁定容器 -->
<div class="md:container md:mx-auto">
<!-- ... -->
</div>
```

<Customizing>

#### Centering by default
#### 默认居中 {#centering-by-default}

```js
// windi.config.js
Expand All @@ -55,7 +55,7 @@ export default {
}
```

#### Horizontal padding
#### 水平内边距 {#horizontal-padding}

```js
// windi.config.js
Expand All @@ -68,7 +68,7 @@ export default {
}
```

Specify a different padding amount for each breakpoint
为每个断点指定不同的内边距大小

```js
// windi.config.js
Expand Down