gpt4 book ai didi

html - Wordpress:CSS 覆盖有序列表 block 不读取起始值

转载 作者:行者123 更新时间:2023-12-05 06:49:46 26 4
gpt4 key购买 nike

我在我的网站上使用以下代码以我想要的方式显示列表项;它有效并且看起来很棒。问题是它忽略了列表 block 中定义的起始值,所以如果我想以 13 的值开始列表,编辑器将其显示为 13,但发布的页面将其显示为 1(例如,它重置每个 block no不管我定义什么起始值)。

我猜这是由于缺少设置计数器(或类似的东西)——问题是我不知道该列表来自 Wordpress block 的元素是什么,也不知道如何调整全局CSS 在定义时继承该“起始值”元素(如果未定义则从 1 开始)。

如有任何帮助,我们将不胜感激。谢谢!

/* === Custom List Settings === */
ol {
counter-reset:li; /* Initiate a counter */
margin-left:0; /* Remove the default left margin */
padding-left:0; /* Remove the default left padding */
}
ol > li {
position:relative; /* Create a positioning context */
margin:0 0 6px 2em; /* Give each list item a left margin to make room for the numbers */
padding:4px 8px; /* Add some spacing around the content */
list-style:none; /* Disable the normal item numbering */
border-top:2px solid #272727;
border-left:2px solid #272727;
background:#0e1014;
}
ol > li:before {
content:counter(li); /* Use the counter as content */
counter-increment:li; /* Increment the counter by 1 */
/* Position and style the number */
position:absolute;
top:-2px;
left:-2em;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
width:2em;
/* Some space between the number and the content in browsers that support
generated content but not positioning it (Camino 2 is one example) */
margin-right:8px;
padding:4px;
border-top:2px solid #272727;
border-right:2px solid #272727;
color:#fff;
background:#0e1014;
font-weight:bold;
font-family:"Helvetica Neue", Arial, sans-serif;
text-align:center;
}
li ol,
li ul {margin-top:6px;}
ol ol li:last-child {margin-bottom:0;}

最佳答案

通过简单地删除所有与计数器相关的内容来修复。

/* === Custom List Settings === */
ol {
margin-left:0; /* Remove the default left margin */
padding-left:0; /* Remove the default left padding */
}
ol > li {
position:relative; /* Create a positioning context */
margin:0 0 6px 2em; /* Give each list item a left margin to make room for the numbers */
padding:4px 8px; /* Add some spacing around the content */
border-top:2px solid #272727;
border-left:2px solid #272727;
background:#0e1014;
}
ol > li:before {
/* Position and style the number */
position:absolute;
top:-2px;
left:-2em;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
width:2em;
/* Some space between the number and the content in browsers that support
generated content but not positioning it (Camino 2 is one example) */
margin-right:8px;
padding:4px;
border-top:2px solid #272727;
border-right:2px solid #272727;
color:#fff;
background:#0e1014;
font-weight:bold;
font-family:"Helvetica Neue", Arial, sans-serif;
text-align:center;
}
li ol,
li ul {margin-top:6px;}
ol ol li:last-child {margin-bottom:0;}

关于html - Wordpress:CSS 覆盖有序列表 block 不读取起始值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66519519/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com