html改有序列表的序号颜色,CSS3 自定义OL/LI有序列表序号样式

CSS

语言:

CSSSCSS

确定

@import url(https://fonts.googleapis.com/css?family=Rambla:400,400italic,700);

html {

box-sizing: border-box;

font-size: 62.5%;

}

*,

*::before,

*:after {

box-sizing: inherit;

}

body {

font-family: Rambla, sans-serif;

font-size: 2rem;

line-height: 1.5;

color: blue;

}

h1 {

text-align: center;

}

.wrapper {

margin: 0 auto;

width: 85%;

display: -webkit-box;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

-webkit-justify-content: space-around;

-ms-flex-pack: distribute;

justify-content: space-around;

}

@media (max-width: 1100px) {

.wrapper {

-webkit-box-orient: vertical;

-webkit-box-direction: normal;

-webkit-flex-direction: column;

-ms-flex-direction: column;

flex-direction: column;

-webkit-box-align: center;

-webkit-align-items: center;

-ms-flex-align: center;

align-items: center;

}

}

ol {

counter-reset: li;

margin: 20px 0;

padding-left: 0;

}

ol > li {

position: relative;

margin: 0 0 25px 2em;

padding: 4px 8px 4px 20px;

list-style: none;

}

ol > li::before {

content: counter(li);

counter-increment: li;

position: absolute;

top: -2px;

left: -2em;

width: 2em;

margin-right: 8px;

padding: 4px;

font-weight: bold;

text-align: center;

}

li ol,

li ul {

margin-top: 6px;

}

ol ol li:last-child {

margin-bottom: 0;

}

.disc > li::before {

color: white;

background-color: blue;

border-radius: 50%;

}

.circle > li::before {

color: blue;

border: solid 2px blue;

border-radius: 50%;

}

.angle > li::before {

color: blue;

border-right: solid 3px blue;

border-bottom: solid 3px blue;

}

.shadow > li::before {

color: white;

background: blue;

box-shadow: 5px 5px 0 0 #009;

}

.rombo > li {

margin-bottom: 25px;

}

.rombo > li::before {

color: white;

z-index: 2;

}

.rombo > li::after {

position: absolute;

top: -2px;

left: -2em;

width: 2em;

margin-right: 8px;

padding: 4px;

background-color: blue;

height: 2em;

-webkit-transform: rotate(45deg);

-ms-transform: rotate(45deg);

transform: rotate(45deg);

content: '';

z-index: 1;

}

.underline > li::before {

border-bottom: solid 3px blue;

}

### 回答1: Sure, here's the code for displaying an ordered list with uppercase letters as the numbering: <ol type="A"> <li>Spring</li> <li>Summer</li> <li>Fall</li> <li>Winter</li> </ol> Hope that helps! ### 回答2: 要写标记语言代码来显示一个有序列表,使用大写字母作为序号,并在列表中显示"Spring"、"Summer"、"Fall"和"Winter",可以使用HTML标记语言来实现。 下面是一个示例代码: ```html <ol type="A"> <li>Spring</li> <li>Summer</li> <li>Fall</li> <li>Winter</li> </ol> ``` 在上述代码中,我们使用了`<ol>`标签来定义一个有序列表,并通过`type`属性设置序号的类型为大写字母。每个列表项使用`<li>`标签包裹,分别包含了"Spring"、"Summer"、"Fall"和"Winter"四个项目。 运行以上代码,将会在浏览器中显示一个有序列表,每个项目前面都会用大写字母进行标记,如下所示: A. Spring B. Summer C. Fall D. Winter ### 回答3: 要写标记语言代码显示一个有序列表,并使用大写字母作为序号,在列表中显示Spring、Summer、Fall和Winter,可以使用HTML标记语言来实现。HTML有序列表使用<ol>和</ol>标签来标识,列表项使用<li>和</li>标签来表示。每个列表项可以添加自定义的id属性,并使用CSS样式指定大写字母作为序号。以下是一个示例代码: <!DOCTYPE html> <html> <head> <style> ol { list-style-type: upper-alpha; } </style> </head> <body> <ol> <li id="item1">Spring</li> <li id="item2">Summer</li> <li id="item3">Fall</li> <li id="item4">Winter</li> </ol> </body> </html> 在上述代码中,<ol>标签定义了一个有序列表,使用CSS样式指定了大写字母作为序号。每个列表项使用<li>标签表示,并在li标签中添加了id属性,可以根据需要自定义id的命名。通过修改CSS样式,可以序号样式,例如要使用小写字母代替大写字母,可以将list-style-type的值为lower-alpha。保存以上代码为.html文件,打开文件可以看到一个有序列表序号为大写字母,显示了Spring、Summer、Fall和Winter这四个季节。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值