We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2366c51 commit fb65e62Copy full SHA for fb65e62
translations/zh-CN/README.md
@@ -45,6 +45,7 @@
45
1. [为更好的移动体验,为表单元素设置字体大小](#为更好的移动体验为表单元素设置字体大小)
46
1. [使用指针事件来控制鼠标事件](#使用指针事件来控制鼠标事件)
47
1. [在用作间距的换行符上设置`display-none`](#在用作间距的换行符上设置display-none)
48
+1. [使用 `:empty` 隐藏空 HTML 元素](#使用-empty-隐藏空-html-元素)
49
50
51
### 使用CSS复位
@@ -624,6 +625,20 @@ br + br {
624
625
626
<sup>[回目录](#目录)</sup>
627
628
+### 使用 `:empty` 隐藏空 HTML 元素
629
+
630
+如果你有空的 HTML 元素,即内容尚未由 CMS 设置或动态注入(例如:`<p class="error-message"></p>`)并且它会在你的布局上创建不需要的空间,使用 `:empty` 伪类隐藏布局上的元素。
631
632
+```css
633
+:empty {
634
+ display: none;
635
+}
636
+```
637
638
+注意:请记住,带有空格的元素不会被视为空元素,例如 `<p class="error-message"> </p>`。
639
640
+<sup>[回目录](#目录)</sup>
641
642
643
### 支持情况
644
0 commit comments