[英]html Heading Background color?
How can I make this number background color in heading (H3)?如何在标题(H3)中制作此数字背景颜色? I'm using Wordpress and I want to make my product heading 1/2/3/4 with the background color.
我正在使用 Wordpress,我想让我的产品标题为 1/2/3/4 的背景色。 Please help me to make this.
请帮我做这个。 enter image description here
在此处输入图片说明
Here's a example to get you started.这是一个让您入门的示例。
The main trick here is the usage of the counters
.这里的主要技巧是
counters
的使用。
section { counter-reset: test; } section h3 { counter-increment: test; position: relative; padding-left: 40px; } section h3::before { content: counter(test) "."; position: absolute; top: -4px; left: 0; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: green; color: white; }
<section> <h3>Section 1 Title 1</h3> <h3>Section 1 Title 2</h3> <h3>Section 1 Title 3</h3> </section> <section> <h3>Section 2 Title 1</h3> </section>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.