我的目录页面的过早回车

时间:2016-04-20 15:41:36

标签: css

我正在使用一个程序(Pressbooks)来出版一本书。我正在做一个目录,有章节。我所经历的是,如果一个标题有这么多的单词,即使它们很容易就能在一行上获胜。标题分为两行。我试图找出要改变的设置,以便整个标题在一行上。

E.g。而不是

11.男孩每天上学

我想

11.男孩每个人都去上学一天。

这是(我相信)相关的CSS代码:

#toc {
  page-break-before: right;
  counter-reset: part;
  font-family: "Noto Serif", "Georgia", "Times New Roman", serif;
  font-size: 1.1em;
 }

#toc h1 {
  text-align: center;
  font-weight: bold;
  font-style: normal;
}

#toc a {
  border: none;
  color: inherit;
}

#toc ul,
#toc li {
  list-style: none;
  margin: 0;
  padding: 0;
}

#toc ul {
  counter-reset: chapter;
  line-height: 1.2em;
}

#toc li {
  position: relative;
}

#toc .front-matter,
#toc .back-matter {
  margin-bottom: 3px;
  font-style: normal;
  font-size: 1.0em;
}

#toc .front-matter .introduction {
  font-style: normal;
}

#toc a::after {
  content: leader(" ") target-counter(attr(href), page);
  font-style: normal;
  font-weight: lighter;
  position: absolute;
  top: 0;
  right: 0;
  text-decoration: none;
}

#toc .front-matter a::after {
  content: leader(" ") target-counter(attr(href), page, lower-roman);
}

#toc .introduction a::after {
  content: leader(" ") target-counter(attr(href), page);
}

#toc .part {
  margin: .5cm 0 0;
  font-weight: 600;
  line-height: 1.2em;
}

#toc .part a::before {
  content: "Part " counter(part, upper-roman) ". ";
  counter-increment: part;
  margin-right: 0.5em;
}

#toc .chapter a {
   padding-left: 0px;
}

#toc .chapter {
  margin-top: 0.5cm;
}

#toc .chapter a::before {
  content: counter(chapter) ". ";
  counter-increment: chapter;
  margin-right: 7pt;
  position: absolute;
  left: 0;
  top: 0;
}

#toc .part a::after {
  content: '';
}

#toc span.toc-chapter-title {
  display: inline-block;
  font-size: 0.9em;
  font-style: normal;
  font-weight: 600;
  width: 70%;
}

#toc .chapter + .back-matter {
  margin-top: 1.3em;
}

#toc span.chapter-author,
#toc span.chapter-subtitle {
  display: inline-block;
  text-indent: 0;
  width: 70%;
}

#toc span.chapter-subtitle {
  font-size: 0.8em;
}

#toc span.chapter-author {
  font-family: "Alegreya SC", "Libre Baskerville", serif;
  text-transform: uppercase;
  font-size: 0.8em;
  position: relative;
}

#toc h1 {
  margin-top: 20pt;
}

#toc .front-matter,
#toc .back-matter,
#toc .chapter {
  margin-bottom: 0.2px;
  margin-top: 0.2px;
}

#toc .part {
  margin: 1em 0 0;
  font-size: 1.1em;
  margin-bottom: 0.75em;
}

#toc .chapter {
  margin-top: 0.15em;
}

#toc .chapter span.chapter-subtitle,
#toc .chapter span.chapter-author {
  margin-left: 20pt;
}

1 个答案:

答案 0 :(得分:0)

没有html很难知道,但你可以尝试将70%的宽度修改为95或100%

#toc span.toc-chapter-title {
  display: inline-block;
  font-size: 0.9em;
  font-style: normal;
  font-weight: 600;
  width: 100%;
}