# 可以跟随文字方向设置的宽高css属性

* 抖音：<https://v.douyin.com/DccfJMX/>
* B站：<https://www.bilibili.com/video/BV1Qs4y137fW/>

> **demo预览：**
>
> <https://sunzsh.github.io/html-demos/writing-mode.html>
>
> **代码：**
>
> <https://github.com/sunzsh/st-html-demo/blob/master/writing-mode.html>

大家用过这3个样式吗

他们都是跟文字方向有关系的

比方说前两个哈

正常情况下呢他就设置宽高的

我先把这3个注释掉

然后呢高度30 大家看就是这么一个文字

但是呢如果我们加上这个文字的方向

writing-mode

大家看 就变成这样了

他还是保持了宽度是

但是呢如果我们用

换了这两个属性我们来试一下啊

大家看他就变成了高度是60宽度是

就是他随着文字的方向改变了

然后呢我们再来看这个padding-block

正常的情况下 我们是用padding就可以了

他是来设置文字的这个

上下的padding

比如说我们现在上下

都设置10px padding

大家看现在是这样的

但是呢如果我们把它旋转

它就变成了相对于文字来说

是左右的排顶

如果我们改用padding-block 大家看

它永远是相对于文字来说是上下的

比如把它再注视掉

它还是上下的


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sunzsh.gitbook.io/xiaoshan.bug/ke-yi-gen-sui-wen-zi-fang-xiang-she-zhi-de-kuan-gao-css-shu-xing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
