> For the complete documentation index, see [llms.txt](https://sunzsh.gitbook.io/xiaoshan.bug/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sunzsh.gitbook.io/xiaoshan.bug/css-li-gei-duo-ge-ci-yu-jia-dou-hao-de-yi-ge-fang-fa.md).

# css里给多个词语加逗号的一个方法

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

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

前两天发现一个好玩的问题哈

我这有几个人名

真实情况下他们是循环出来的

（我这只是一个模拟）

然后呢

我想让他们中间啊加上一个顿号

不管有多少个人名

第一个前面没有，就是中间有

后来我发现一个比较好玩的实现方法

就是首先呢我们先给他们呀

肯定都有一个class类

比如我们就叫 item

然后呢我们这块怎么写呢

.item+.item

意味着找到第二个

以及后边的这个span(.item)标签

然后写::before

然后呢写content（其实很简单）

大家看 我这块是逗号把它改成顿号

这样就可以了

这样无论有多少个

他都会自动加上这个顿号
