> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/css/layout/center.md).

# vertical centering

* :tools: [How to Center in CSS?](http://howtocenterincss.com)
* :point\_right: [vertical-align](/web/css/layout/vertical-align.md)

## 重點 <a href="#notes" id="notes"></a>

```css
/* inline element */
text-align: enter;

/* block element */
margin: 0 auto;

/* flex */
display: flex;
justify-content:center;
align-items:center;
```

## 參考 <a href="#ref" id="ref"></a>

{% tabs %}
{% tab title="📗 文章" %}

* [CSS Vertical Align - How to Center a Div, Text, or an Image](https://www.freecodecamp.org/news/css-vertical-align-how-to-center-a-div-text-or-an-image-example-code/) (freeCodeCamp)
  {% endtab %}
  {% endtabs %}
