如何格式化有序列表项目编号? [英] How to format ordered list-item numbers?

查看:73
本文介绍了如何格式化有序列表项目编号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.liarsscourge.com/ewpi.html


列表编号应格式化为< h3>,但< li>

中的其他文本应为普通文本。


< ol>

< li>

< h3 id =" d2">下载最新的WordPress代码< / h3> ;

[其他文字,图片和格式在这里]

< / li>

< / ol>


我尝试将开头< liin放在< h3heading,但验证失败。


我也尝试修改这样的样式表:


#ewpi li {

font-weight:bold;

}


但这改变了整个< li>,而不仅仅是列表编号。


如何将格式仅应用于< linumber,而不是整个< li?

提前致谢。

解决方案

deko写道:

http:/ /www.liarsscourge.com/ewpi.html


列表编号应格式化为< h3>,但
$ b $中的其他文字b< li>

应为普通文本。


< ol>

< li>

< h3 id =" d2">下载最新的WordPress代码< / h3>

[其他文字,图片和格式在这里]

< / li>

< / ol>


我尝试将开头< liin放在< h3heading上,但是失败了

验证。


我也尝试修改这样的样式表:


#ewpi li {

字体-weight:粗体;

}


但这会改变整个< li>,而不仅仅是列表编号。


如何仅将格式应用于< linumber,而不是整个& LT;


提前致谢。



您没有选择器只指定列表项的一部分。

您可以在li''内容'周围添加< spantags并为此设置font-weight



一个工作示例:


< html>

< head>

< title> Ordered List - css< / title>

< style>

li.bold {

font-weight:bold;

}

li.bold span {

font-weight:normal;

}

< / style>

< / head>

< body>

< ol>

< li class =" bold">< ; span>< h3> Yadda yadda< / h3> foo和bar< / li>< / span>

< li class =" bold">< span>< h3> Bladibla< / h3> bar vs foo< / li>< / span>

< / ol>

< / body>

< / html>


HTH,
Sh。


Schraalhans Keukenmeester写道:


deko写道:
< blockquote class =post_quotes>
> http://www.liarsscourge .com / ewpi.html

列表编号的格式应为< h3>,而< li>
中的其他文字应该是正常的文本。

< ol>
< li>
< h3 id =" d2">下载最新的WordPress代码< / h3>
[其他文字,图片和格式在这里]
< / li>
< / ol>

我试过把开头< liin< h3heading,但是失败了
验证。



[snip]


< style>

li.bold {

font-weight:bold;

}

li.bold span {

font-weight:normal;

}

< / style>

< / head> ;

< body>

< ol>

< li class =" bold">< span>< h3> Yadda yadda< / h3> foo和bar< / li>< / span>

< li class =" bold">< span>< h3> Bladibla< / h3> bar vs foo< / li>< / span>

< / ol>

< / body>

< / html>


HTH,

Sh。



哎呀,对不起,< spantags应该*在< li>< / litags内。我的不好。

Sh。


文章< ys ***************** *************@comcast.com> ;,

" deko" < de ** @ nospam.comwrote:

http://www.liarsscourge.com/ewpi.html


列表编号应格式化为< h3>,但<< h3>内的其他文字li>

应为普通文本。


< ol>

< li>

< h3 id =" d2">下载最新的WordPress代码< / h3>

[其他文字,图片和格式在这里]

< / li>

< / ol>



但是你的列表内容不是一组列表项,是吗?

每个项目实际上是一系列段落。最简单的解决方案

将简单地在标题中明确写出数字。


< h2> 1。下载最新的WordPress代码< / h2>


< p> blah blah blah< / p>



< p>更多blah< / p>


(注意我还修复了你的标题,这是你提供的URL的文件的

上下文中的第二级;如果你使用

h3使文本看起来小于h2 ,不 - 那是什么

CSS用于!)

如果你_really_想要让用户代理将数字放入

标题,那么你需要这样的东西:


< ol class =" mainheadings">

< li">下载最新的WordPress代码

< ul class =" subsectioncontent">

< li> blah< / li>

< li> blah< / li>

< / ul>

< / li>

...

< / ol>


- 但我不相信将图像和文字填入

无序列表项这是一个很棒的主意,并且仍然是b $ b $ make尝试将非列表内容强制为

列表格式的更多工作。


我尝试将开头< liin< ; h3heading,但是失败了

验证。


我也尝试修改这样的样式表:


# ewpi li {

font-weight:bold;

}


但这会改变整个< li>,而不仅仅是列表编号。

如何仅将格式应用于< linumber,而不是整个< li?



简单的回答是,通过尝试使用b $ b来简化生活会让生活变得更加艰难。快速浏览列表项在CSS规范建议

你可能需要使用样式的< span>< / spanon列表项

文本来获得你想要的差异。我会再问,为什么?你好b / b
真的没有那么多需要编号的东西。


(嗯 - 是否有自动编号的html / css选项

根据他们的h1 / h2 / h3 / etc出现的头文件?看看

那一个,但它肯定会有用......)


http://www.liarsscourge.com/ewpi.html

The list numbers should be formatted as <h3>, but other text within the <li>
should be normal text.

<ol>
<li>
<h3 id="d2">Download latest WordPress code</h3>
[other text, images and formatting here]
</li>
</ol>

I tried putting the opening <liin the <h3heading, but that fails validation.

I also tried modifying the stylesheet like this:

#ewpi li {
font-weight:bold;
}

but that changes the whole <li>, not just the list number.

How do I apply formatting to only the <linumber, not the whole <li?

Thanks in advance.

解决方案

deko wrote:

http://www.liarsscourge.com/ewpi.html

The list numbers should be formatted as <h3>, but other text within the
<li>
should be normal text.

<ol>
<li>
<h3 id="d2">Download latest WordPress code</h3>
[other text, images and formatting here]
</li>
</ol>

I tried putting the opening <liin the <h3heading, but that fails
validation.

I also tried modifying the stylesheet like this:

#ewpi li {
font-weight:bold;
}

but that changes the whole <li>, not just the list number.

How do I apply formatting to only the <linumber, not the whole <li?

Thanks in advance.

You have no selector that specifies only part of the list item.
You could add <spantags around the li ''content'' and set font-weight
for that.
A working example:

<html>
<head>
<title>Ordered List - css</title>
<style>
li.bold {
font-weight : bold;
}
li.bold span {
font-weight : normal;
}
</style>
</head>
<body>
<ol>
<li class="bold"><span><h3>Yadda yadda</h3>foo and bar</li></span>
<li class="bold"><span><h3>Bladibla</h3>bar vs foo</li></span>
</ol>
</body>
</html>

HTH,
Sh.


Schraalhans Keukenmeester wrote:

deko wrote:

>http://www.liarsscourge.com/ewpi.html

The list numbers should be formatted as <h3>, but other text within
the <li>
should be normal text.

<ol>
<li>
<h3 id="d2">Download latest WordPress code</h3>
[other text, images and formatting here]
</li>
</ol>

I tried putting the opening <liin the <h3heading, but that fails
validation.

[snip]

<style>
li.bold {
font-weight : bold;
}
li.bold span {
font-weight : normal;
}
</style>
</head>
<body>
<ol>
<li class="bold"><span><h3>Yadda yadda</h3>foo and bar</li></span>
<li class="bold"><span><h3>Bladibla</h3>bar vs foo</li></span>
</ol>
</body>
</html>

HTH,
Sh.

Oops, sorry, the <spantags should be *inside* the <li></litags. My bad.
Sh.


In article <ys******************************@comcast.com>,
"deko" <de**@nospam.comwrote:

http://www.liarsscourge.com/ewpi.html

The list numbers should be formatted as <h3>, but other text within the <li>
should be normal text.

<ol>
<li>
<h3 id="d2">Download latest WordPress code</h3>
[other text, images and formatting here]
</li>
</ol>

But your list content is not properly a set of list items, is it?
Each "item" is actually a series of paragraphs. The easiest solution
would be to simply write the number explicitly in the heading.

<h2>1. Download latest WordPress code</h2>

<p>blah blah blah</p>

<h2>2. Next step</h2>

<p>More blah</p>

(Note I''ve also fixed your headers, which are second-level in the
context of the document who''s URL you provided; if you are using
h3 to make the text appear smaller than an h2, don''t - that''s what
CSS is for!)

If you _really_ want to have the user agent put the numbers in the
headings, then you need to so something like this:

<ol class="mainheadings">
<li">Download latest WordPress code
<ul class="subsectioncontent">
<li>blah</li>
<li>blah</li>
</ul>
</li>
...
</ol>

- but I''m not convinced that stuffing images and text into
unordered list items is such a great idea, either, and still
makes more work by trying to force non-list content into a
list format.

I tried putting the opening <liin the <h3heading, but that fails
validation.

I also tried modifying the stylesheet like this:

#ewpi li {
font-weight:bold;
}

but that changes the whole <li>, not just the list number.
How do I apply formatting to only the <linumber, not the whole <li?

The short answer is that you''re making life more difficult by trying
to make it easier. A quick browse of "list-item" in the CSS spec suggests
that you might need to use a styled <span></spanon the list item
text to get the difference you want. Again, I would ask, why? You
really don''t have that many things that need numbering.

(Hmm - is there an html/css option for automatically numbering
headers according to their h1/h2/h3/etc occurrence? Have to look
that one up, but it would certainly be useful...)


这篇关于如何格式化有序列表项目编号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆