如何更改列表中第一个元素之前和最后一个元素之后的间距

问题描述 投票:0回答:1

我正在为一本 EPUB 图书创建索引。我创建了包含子条目的条目,如下所示:

coal
    anthracite
    bituminous coal
    brown coal
    imports
    reserves
    seams
[next main index entry]

这里“煤”为主索引条目,“无烟煤”等为子条目。问题是第一个子条目之前和最后一个子条目之后的空间太多。 (注意:不在各个子条目之间。)也就是说,它看起来像这样:

coal

    anthracite
    bituminous coal
    brown coal
    imports
    reserves
    seams
    
[next main index entry]

这是代码:

<body class="rear-matter" id="rear-matter">
<div class="rear-matter">
<h1 class="title" id="index">
<a href="contents.xhtml">Index</a></h1>

    <li epub:type="index-entry">
        <span epub:type="index-term">coal</span>
        <ul epub:type="index-entry-list">
            <li epub:type="index-entry">
                <span epub:type="index-term"><a href="chapter_1169115.xhtml#anthracite" id="coal_reserves">anthracite</a></span>
            </li>
            <li epub:type="index-entry">
                <span epub:type="index-term"><a href="chapter_1174195.xhtml#bituminous coal" id="bituminous coal">bituminous coal</a></span>
            </li>
            <li epub:type="index-entry">
                <span epub:type="index-term"><a href="chapter_1174195.xhtml#brown coal" id="brown coal">brown coal</a></span>
            </li>
            <li epub:type="index-entry">
                <span epub:type="index-term"><a href="chapter_1174195.xhtml#coal imports" id="coal imports">imports</a></span>
            </li>
            <li epub:type="index-entry">
                <span epub:type="index-term"><a href="chapter_1169115.xhtml#coal reserves" id="coal reserves">reserves</a></span>
            </li>
            <li epub:type="index-entry">
                <span epub:type="index-term"><a href="chapter_1169115.xhtml" id="coal_seams">seams</a></span>
            </li>
        </ul>
    </li>

我认为间距与标签

html css xhtml epub
1个回答
0
投票

您可能正在寻找这样的东西:

ul {
  margin-block-start: 0.2em;
  margin-block-end: 1em;
}

更多信息:https://developer.mozilla.org/en-US/docs/Web/CSS/margin-block-start

© www.soinside.com 2019 - 2024. All rights reserved.