[/list][h2]灵活使用伪类[/h2]不要让非内容信息污染了你的 HTML,打乱了 HTML 结构。可以使用:before、:after 等伪类元素
推荐:
HTML 代码
[code] See the square next to me?
复制代码
CSS 代码:
/* We use a :before pseudo element to solve the design problem of placing a colored square in front of the text content */.text-box:before { content: ''; display: inline-block; width: 1rem; height: 1rem; background-color: red;}